Labour was all but wiped out in Scotland, the Liberal Democrats were left with just eight MPs and UKIP’s Nigel Farage quit after failing to win Thanet South, losing to the Conservatives by nearly 2,800 votes.
Miliband said he took “absolute and total responsibility” for the result. He added: "Britain needs a strong Labour Party, Britain needs a Labour Party that can rebuild after this debate so we can have a government that stands up for working people again.
"And now it is time for someone else to take forward the leadership of this party. So I am tendering my resignation, taking effect after this afternoon's commemoration of VE Day at the Cenotaph.
"I want to do so straight away because the party needs to have an open and honest debate about the right way forward, without constraint."
Earlier Nick Clegg, former deputy prime minister and Lib-Dem leader, said: “Fear and grievance have won. Liberalism has lost. But it is more precious than ever and we must keep fighting for it.
“It is easy to imagine there is no road back. There is.
“This is a very dark hour for our party but we cannot and will not allow decent liberal values to be extinguished overnight.”
Farage, who previously promised to resign if he lost his seat in Westminster, said: “There was an earthquake in this election. It happened in Scotland, and I think what you saw were a lot of voters so scared of that Labour-SNP coalition that they shifted towards the Conservatives.
"That included some of the people here who voted Ukip last time round.
"But I saw another shift in this election and I saw Ukip the party, apparently the party for retired old colonels, suddenly the party for people under 30, particularly young working women. There is a big change going on in politics.
Housing minister Brandon Lewis, who was standing for the Conservatives in Great Yarmouth, successfully retained his seat with 43% of the vote.