Lebanon has one of the highest debt levels in the world.
The protests have led to a 10-day closure of banks, with many other offices, schools and universities also shut.
What did Mr Hariri say?
In a televised address, the prime minister said he had reached a "dead end" and that he would tender his resignation and that of the government to President Michel Aoun.
Mr Hariri said: "For 13 days, the Lebanese people have waited for a decision for a political solution that stops the deterioration. And I have tried, during this period, to find a way out, through which to listen to the voice of the people."
But he added: "It has become necessary for us to make a great shock to fix the crisis.
"Posts come and go, what matters is the safety and dignity of the people."
President Aoun is still to comment. If the resignation is accepted, the constitution would require Mr Hariri to stay on until a new administration is established.
What is the state of the protests?
The prime minister's announcement came as the situation on the ground turned increasingly violent, reflecting the deep-seated schism in Lebanese society.
The militant Shia group, Hezbollah, which has dominated the coalition government led by Mr Hariri, a Sunni, has recently hardened its stance against the protests.
On Tuesday, black-clad men loyal to Hezbollah and another Shia group, Amal, ransacked a protest camp in central Beirut, chanting slogans, setting tents on fire and beating anti-government demonstrators. A roadblock set up by protesters was also attacked.
Riot police and troops fired tear gas to separate the rival groups.
The protesters remained defiant in central Beirut. Less than an hour after being attacked they erupted into applause at the announcement of Mr Hariri's resignation.
One demonstrator, Tima Samir, told Agence France-Presse: "This resignation is welcome but it is not enough... We want the entire system to change and we'll stay on the streets until all our demands are met."