In his announcement, given just moments ago from Downing Street, Mr Cameron said he will “steady the ship” but aimed to have a new prime minister in place by October.
He said: "I fought this campaign the only way I know how to saying directly and passionately what I think and feel.
"The British people have taken a very clear decision to take a different path and as such the country needs fresh leadership."
He added: "I always believe we have to confront big decisions and not duck them."
The Prime Minister said the British people had voted to leave the European Union and that must be accepted. He said it was not a decision taken lightly and there can be no doubt about the result.
He also said he wanted to reassure the markets that British economy is strong and there will be no initial changes for residents.
“I’m very proud and very honoured to have been Prime Minister of this country for six years,” Cameron continued.
“I believe we’ve made great steps, with more people in work than ever before in our history, with reforms to welfare and education, increasing people’s life chances, building a bigger and stronger society, keeping our promises to the poorest people in the world and enabling those who love each other to get married whatever their sexuality, but above all restoring Britain’s economic strength.”
Speaking of the result, he said: “The country requires fresh leadership to take it in this direction.
“I will do everything I can as Prime Minister to steady the ship over the coming weeks and months, but I don’t think it would be right for me to try to be the captain that steers our country to its next destination.”