Cameron said he will stay in office for a short spell, but has set a timeline for a new Prime Minister to be in place in October by the time of the Conservative Party conference.
|Brexit Britain: What you need to know|
Here are the latest reactions to Cameron's resignation...
Boris Johnson, member of parliament and former mayor of London, Conservative Party
"I've known David Cameron for a very long time, and I believe he's been one of the most extraordinary politicians of our age.A brave and principled man. Superb leadership.
"It was his bravery that gave this country the first referendum on the country for 44 years."
Michael Gove, justice secretary, Conservative Party
"David Cameron has led this country with courage, dignity and grace. He has rebuilt our economy, made opportunity more equal. He deserves to be remembered as a great prime minister."
Natalie Bennett, leader, Green Party
"It is right that David Cameron has announced his resignation this morning. The UK requires fresh leadership after a bitter, divisive campaign. We must all work to bring communities that have been driven apart back together. That healing process begins this morning.
"But it is important that the coming days are not dominated by Conservative manoeuvring at the expense of broader, wider and more long-term debates about Britain's future."
Tim Farron, leader, Liberal Democrats
"12 months ago David Cameron had the best result of his career. Today, the worst. I was honoured to share a platform with the Prime Minster on this campaign, but this result, this self-inflicted wound, will be his legacy.
"The result of the referendum has left him with no choice. David Cameron has become the latest Conservative leader to fall victim to his party’s dangerous obsession with Europe. The Conservative’s political manoeuvring has taken our country to the brink, and today we have toppled over the edge."
Thomas Lake, political risk analyst, BMI Research
"Cameron's resignation was not an unexpected event. The result of the referendum saw his political credibility evaporate over the course of the night, and if he had tried to stay on a group of hardcore eurosceptic Conservative backbenchers could have made it extremely uncomfortable for him with regards to retaining a parliamentary majority.
"By laying out a rough timetable for his leaving office (by Conservative party conference in October) Cameron has sought to restore some stability to an extremely uncertain time, and this period will allow the Conservative party and the country at large some breathing space and time to take stock."
Josh Mahony, market analyst, IG
"The moment it became clear that the UK was set to leave the EU, David Cameron's time as the leader of this country was always likely to be limited. The issue is one of credibility from a negotiation point of view and given Cameron's staunch position that we should remain in the EU, he clearly isn't the man for the job.
"However, we are now faced with a scenario where one of the most democratic acts of modern history is now resulting in an undemocratic appointment of our new leader. The vote shouldn't have been about personalities but in the end it has led to a switch of personnel in Downing Street, with Boris' gamble paying dividends given his likely appointment as Cameron's successor."
The business lobby
Simon Walker, director general, Institute of Directors
"It was important that the Prime Minister outlined his plans quickly. Now that we know that he will be leaving before the Conservative party conference, we look forward to him keeping the ship of government steady while a new leader is found.
"In the short-term, David Cameron has reassured the country that nothing will change for firms employing EU citizens, or for businesses’ trading relationships. For those wishing to replace him, we urge top priority is placed on negotiating a new arrangement that gives UK companies access to the single market, and the much-needed skills of EU workers."
Read more: Here's how Brexit will affect house prices
Carolyn Fairbairn, director general, Confederation of British Industry (CBI)
"David Cameron is a respected Prime Minister. He has chosen to step down and has set out a clear timeline for doing so, which will help provide stability as we embark on important negotiations to determine our future relationship with the EU. Businesses will welcome the decision that negotiations will only begin once the new leadership is in place.
"The Prime Minister made clear that all sides should come together to work out the best way forward for the country - and the CBI, working with our members, will do everything we can to support this."