A further 70 people are reported to have been injured in the blaze at an industrial complex in Tongi, north of the capital Dhaka.
Police said about 100 people were in the four-storey building at the time, including machine operators and guards.
The blast was caused by an explosion in the boiler room, at the start of the working day, officials say.
Firefighters are struggling to bring the blaze under control.
Local fire and civil defence chief Anis Ahamed said there were now 20 fire trucks working to extinguish the fire.
"We have removed eight bodies to the hospital and are trying to retrieve a further two. Once the fire is out we will be able to enter the damaged structure to see if there are more bodies," he said.
Relatives have been gathering outside the local hospital for news.
One man, Wridoy Barua, said he was looking for his brother. "I haven't heard from him since this morning. There is no news of him."
Low-cost manufacturing is a mainstay of Bangladesh's economy, but a series of industrial disasters in recent years have raised concerns about safety standards, the BBC's South Asia Editor Jill McGivering reports.
Tighter controls have been introduced, but dozens of workers still die every year, she notes.
Bangladesh factories: 'About 40% have major safety issues'
Can Bangladesh safety accord bring change?
At least 13 people  died in a fire at a plastics factory Dhaka last year.
In 2012, 112 workers died in a fire at a factory just outside the capital.
The country suffered an even greater tragedy in 2013 when the Rana Plaza garment complex collapsed on the outskirts of Dhaka, killing 1,135 people.

The firm, which has had a presence in the city for more than 30 years, says it follows a restructuring review.
The office will shut later this year but a new "commercial trading site" will open in the city in September. Staff are to be offered redeployment around the UK, a spokesman said.
Union Unite called it a "big blow" for the finance sector in Birmingham.
Regional secretary, Gerard Coyne, said: "[Royal Sun Alliance] have made us aware of their intention to close the Birmingham office.
Updates on this and more from Birmingham and Black Country
"We will now enter into discussions with them and try to get them to review their decision in Birmingham as it's a big blow to our members and the finance and insurance sector in the city."
Royal Sun Alliance told staff on Wednesday that 190 jobs were at risk of redundancy but was "committed" to staying in the city. It has been at its current site in Colmore Row for 20 years.
A spokesman said the firm's review showed it could work more effectively "if teams doing the same kind of work, or focused on the same kinds of customers, are situated together".
"Unfortunately, a number of our employees will be impacted by these changes and we will be working closely with them over the next few months and will look to redeploy our people wherever possible."
At least 20 people have been killed in a huge fire that broke out at a packaging factory in Bangladesh.
[NEXT_CONCEPT]
One of the UK's biggest insurers Royal Sun Alliance is to close its Birmingham office, putting 190 jobs at risk.