We don't know exactly when Shakespeare started writing plays, but they were probably being performed in London by 1592, and he's likely to have written his final plays just a couple of years before his death in 1616.
It is believed that he wrote around 38 plays, including collaborations with other writers. Here's a chronological list of Shakespeare's plays by decade.