While it was generally thought to be an accident, some believed it could be arson.
Interior Minister Shahara Khatun said after visiting the site that her ministry would investigate whether it was related to recent violent protests at textile factories over wages.
Monir Hossain, a local journalist at the scene, told The Associated Press the blaze broke out on the two upper floors during lunch break. A gate on a stairwell was locked, trapping people inside the factory, which mainly produces T-shirts for international brands, he quoted witnesses as saying.
Another journalist, Rafiqul Islam, said he saw at least 25 bodies being loaded onto ambulances.
Diganta television reported at least 26 people died and more than 100 were injured. ATN News said rescuers recovered at least 24 bodies.
Islam said about 13,000 people work at the factory each day, though most were outside buying lunch when the fire started. Officials predicted the death toll would rise, he said.
Soldiers and police cordoned off the building as firefighters continued their search.
The company and the Bangladesh Garment Manufacturers and Exporters Association announced they would provide 100,000 takas ($1,370) in compensation to families of the dead and would pay for the treatment of the injured.
Workers' safety in the rapidly growing textile industry is a major concern but in recent years has improved, the association said.
Labor rights groups say safety standards are still inadequate in many factories.
In February, a fire at a sweater factory just outside Dhaka killed 21 people and injured dozens.
Bangladesh has about 4,000 garment factories that export more than $10 billion worth of products a year, mainly to the United States and Europe. Customers include Wal-Mart, Tesco, H&M, Zara, Carrefour, Gap, Metro, JCPenney, Marks & Spencer, Kohl's, Levi Strauss and Tommy Hilfiger.
Recent protests by low-paid garment workers have gripped the country. Workers demanding the implementation of a new minimum wage clashed with police at an industrial zone in southeastern Bangladesh on Sunday, leaving up to three people dead and 100 hurt.
Authorities opened fire and used tear gas after thousands of workers attacked factories and smashed vehicles at the Chittagong Export Processing Zone. The zone -- 135 miles (215 kilometers) southeast of Dhaka -- houses about 70 foreign companies that mainly manufacture garments, shoes and bicycles, and employ about 150,000 workers.
Smaller protests have taken place around Dhaka. On Sunday, workers in the capital blocked a busy road and set two vehicles on fire, police said.
Garment workers in Bangladesh are among the lowest-paid in the world, according to the International Trade Union Confederation, a Vienna-based labor rights group.
In the first increase since 2006, the government in July raised the official minimum wage to 3,000 takas ($45) a month from 1,662 takas ($25). The new pay structure took effect in November, but workers say many factories haven't implemented it yet.