She will stay on as prime minister until a replacement is found but that search is well under way.
So, why is Mrs May going and what does it mean for the future of the UK?
Why is Theresa May stepping down?
During her time as prime minister, Theresa May failed to complete her most important task: delivering Brexit.
UK voters had backed ending membership of the European Union, by 52% to 48%, in June 2016.
Two and a half years later, a plan agreed by the UK and the EU was delivered, setting out how Brexit would happen.
But some Conservative MPs felt it was a “bad deal” and several of Mrs May’s ministers resigned.
Much of the criticism was aimed at the Irish backstop – intended to prevent border posts between Northern Ireland and the Republic of Ireland.
Attempts to get MPs to fall in line were all in vain and the Brexit deal was rejected on three separate occasions.
The UK’s departure date has been delayed to 31 October and, faced with mounting pressure in her ranks, Mrs May announced her departure.
Who wants to be prime minister?
The race has already started. With 11 contenders, it’s a crowded field.
Boris Johnson, a colourful and well known figure in the UK, is the current favourite. He is a former foreign secretary and London mayor.
But it’s by no means a foregone conclusion – early frontrunners have not always gone on to win.
In fact, Mr Johnson was seen as a favourite in the 2016 contest – before his main backer, Michael Gove, unexpectedly entered the contest. That decision torpedoed Mr Johnson’s campaign and Mr Gove stood accused of “backstabbing”.
To add to the drama, Mr Gove is standing this time round too.
Of the 11 contenders, just two are women.
Who chooses the next leader?
The winner needs the backing of both Conservative MPs and ordinary party members.
To be nominated, candidates need the signatures of eight fellow MPs. They are then whittled down to two in a series of secret votes by Conservative MPs.
The contest ends in a vote open to those who have paid to be members of the Tory Party.
It means that just 124,000 people will be choosing the next leader of a country of more than 65 million people.
Most party members are over 55 and a large majority are from the top social class.
The winner of the contest – and new prime minister – will be announced in the week of 22 July.
- Tory leadership: Who will replace Theresa May
- The people who will choose the UK’s next prime minister
Will there be a general election?
A new prime minister doesn’t necessarily mean a general election is inevitable.
As the Conservatives are already in power, they won’t have to hold one.
But the new prime minister may feel they need to win public backing for their Brexit plan.
If they did decide to call an election, the prime minister would also require at least two-thirds of MPs to agree to it.
Where does this leave Brexit?
Despite Mrs May’s departure, the problem of Brexit is far from resolved.
Coming up with a solution that will define the future relationship of the UK with its European neighbours has been occupying her would-be successors.
There are a number of options.
The first is passing Mrs May’s deal, an idea favoured by one of the candidates, Rory Stewart. But this could be a quite a challenge given that it has been rejected three times.
The second option is to renegotiate the existing deal. This is what most of the leadership hopefuls want – but the EU has previously said the existing deal can’t be changed.
There’s also no guarantee that a revised deal can be agreed before the Brexit deadline. Boris Johnson, for example, has said the UK will leave on 31 October “deal or no deal”.
- Where do the Conservative candidates stand?
- How could another referendum work?
- How the Brexit timeline could unfold
The third option is to leave without a deal, immediately cutting ties with the EU. But this could be problematic, as MPs have previously rejected it as an option.
Lastly, they could choose to call another Brexit referendum. However, MPs haven’t previously backed the idea of another public vote.
In short, whoever takes over from Theresa May will find that life is far from straightforward.