In some of the fiercest violence to rock the capital since independence four decades ago, hundreds more people were reported to have been injured as riot police broke up the rally near a key commercial district in a pre-dawn raid.
Dozens of demonstrators were also arrested while the leader of the protests was put on a plane to the second city Chittagong.
Hundreds of bankers, insurance officials and stock traders had to sleep in their offices as the sound of gunfire echoed around the Motijheel Commercial Area through much of the night.
Shops were torched and thousands of rocks littered the ground, said witnesses.
Police said they used sound grenades, water cannon, tear gas and rubber bullets to disperse at least 70,000 Islamists who were camped at Motijheel as part of a push for a new blasphemy law.
"We were forced to act after they unlawfully continued their gathering at Motijheel. They attacked us with bricks, stones, rods and bamboo sticks," Dhaka police spokesman Masudur Rahman told AFP.
The protesters dispersed early Monday, he added.
Mozammel Haq, a police inspector at Dhaka Medical College Hospital, told AFP that 11 bodies were brought to the clinic, including a policeman who had been hacked in the head with machetes.
Eleven other bodies were taken to three other clinics. Hospital officials said hundreds of people were injured.
There was also deadly violence at Kanchpur on the southeastern outskirts of Dhaka. More than 5,000 Islamists clashed with police and border guards, prompting security forces to respond with live rounds, local police chief Abdul Matin told AFP.
At least six people were killed there including three policemen and a border guard, police official Rezaul Karim told AFP. The private Somoy TV put the toll in Kanchpur at 13.
A pro-Islamist television channel which broadcast live footage of the raid on Motijheel was meanwhile forced off the air in a dawn raid.
Diganta Television's chief reporter M. Kamruzzaman said that around 25 plain-clothed policemen and an official from the broadcast commission had entered their studios without warning.
The violence erupted Sunday afternoon after police tried to disperse tens of thousands of Islamists who had blocked major highways in Dhaka.
The protests had been instigated by Allama Shah Ahmad Shafi, the leader of Hefajat-e-Islam who is said to be around 90 years old.
Police managed to persuade Shafi on Monday to leave his madrassa in Dhaka, escorting him to the airport from where he was to be flown to Chittagong.
In a sign of their wish to avoid inflaming tensions, police insisted he had not been arrested but was leaving of his own volition.
Prime Minister Sheikh Hasina has ruled out a new blasphemy law, insisting she will not cave into the demands of hardliners who have been infuriated by bloggers whom they accuse of insulting the Prophet Mohammed.
Chanting "One point, One demand: Atheists must be hanged", activists from the hardline Hefajat-e-Islam marched along at least six highways.
Police said the number of protesters reached around 200,000 people at one point although the numbers had dwindled by the early hours.
Social media networks were inundated with photos of bloodied Islamists lying on the streets after the crackdown.
Fearing further violence, Dhaka police Monday banned all protests as well as the carrying of firearms until midnight.
Bangladesh, an officially secular country with a 90 percent Muslim population, has seen a surge in violence between Islamists and government forces since the start of the year when a court began handing down war crimes verdicts related to the 1971 independence conflict.
Three leading Islamists have so far been convicted for their role in mass killings during the conflict, which saw what was then East Pakistan break from the regime in Islamabad.
The overall death toll in violence between religious hardliners and the police since January now stands at more than 140.