In an emotional statement, she said she had done her best to deliver Brexit and it was a matter of "deep regret" that she had been unable to do so.
Mrs May said she would continue to serve as PM while a Conservative leadership contest took place.
The party said it hoped a new leader could be in place by the end of July.
It means Mrs May will still be prime minister when US President Donald Trump makes his state visit to the UK at the start of June.
Asked about the prime minister's announcement, Mr Trump said: "I feel badly for Theresa. I like her very much. She's a good woman. She worked very hard. She's very strong."
Mrs May said she would step down as Tory leader on 7 June and had agreed with the chairman of Tory backbenchers that the contest to replace her should begin the following week.
Foreign Secretary Jeremy Hunt has become the latest MP to say that he will run, joining Boris Johnson, Esther McVey and Rory Stewart.
More than a dozen other MPs are believed to be seriously considering entering the contest.