Dozens of people were trapped in the buildings, unable to escape onto narrow streets clogged with traffic, as the highly-combustible stores of chemicals, body sprays and plastic granules erupted in flames, presstv.ir reported.
Bangladesh's fire service chief Ali Ahmed said the death toll was expected to rise "The number of bodies may increase. The search is still going on," he told AFP.
Ahmed said the blaze at Chawkbazar in the old part of Dhaka might have originated from a gas cylinder before quickly spreading through a building where chemicals were stored.
The flames raced through four adjoining buildings, which were also used as chemical warehouses.
"There was a traffic jam when the fire broke out. It spread so quickly that people could not escape," he said, describing a part of town where the streets are very narrow and the residential buildings stand inches apart.
Witnesses said members of a bridal party in a nearby community center were also caught in the fire and many of them were injured.
Deputy Commissioner of Dhaka Metropolitan Police Ibrahim Khan said at least two cars and 10 cycle rickshaws were burned in the fire.
"The victims included passersby, some people who were eating food at restaurants and some members of the bridal party," he said.
Another fire official told reporters the blaze, which began around 10.40pm (16:40 GMT) on Wednesday, has been "confined" but not yet doused despite the efforts of more than 200 firefighters.
"It will take time. This is not like any other fire," he said, adding the inferno became so devastating due to the "highly combustible" chemicals stored there.
Television images showed firefighters climbing ladders to try to spray water on one of the buildings where the fire has largely been contained.
A police inspector at the Dhaka Medical College Hospital said at least 45 people were injured, including four people whose conditions were critical.
Hundreds of people rushed to the hospital to look for their missing relatives.
Sohag Hossain, one of the injured, told the Daily Star that he and two of his friends were working at a plastic factory in one of the buildings at the time of the fire. Suddenly, they heard a huge noise. They tried to flee but could not escape the fire.
A similar fire in 2010 in an old Dhaka building, which was also used as a chemical warehouse, killed more than 120 people in one of the worst fire tragedies in Dhaka.
After that fire, Dhaka city authorities launched a crackdown on chemical warehouses in residential areas, but in recent years the drive ground to a total halt.