The Sherlock and Star Trek actor will bring the play's eponymous character to life at the Barbican Theatre from August to October 2015.
Cumberbatch had previously told the Daily Telegraph that Hamlet is "a role I've been interested in for a long time."
The star also expressed a sense of urgency about the role, "I don't know if there is such a thing as a right age to play the part, but 36 or 37 seems appropriate to me, so I need to do it before too long."
Sonia Friedman Productions will produce the play, with Lyndsey Turner to direct.
Friedman is "thrilled" to be part of the production, and says that Cumberbatch is "one of the most gifted and exciting actors of his generation."
The actor last appeared on stage in 2011 for a production of Frankenstein at the National Theatre in London. He and actor Jonny Lee Miller shared the roles of Frankenstein and his Monster.
Cumberbatch will have a busy 2015, as he is also slated to appear in the upcoming films Everest and The Lost City of Z.
Booking details for the upcoming production of Hamlet will be released in May.