Police and local officials said the accident happened at 3.30pm at the factory in Ban Khoi Ngam or Moo 3 village in Tambon Sala Khao of Muang district.
Authorities believe the 23 workers were assembling the fireworks when suddenly there was an explosion, flattening the factory and killing all of them.
Local villagers said the factory normally had about 30 people working inside but on Wednesday it was believed 23 workers were inside.
Rescue officials said the explosions blew up their bodies, and body parts were retrieved from about 50 metres away and even in the rice fields. They said it was hard to identify the victims.
The accident was immediately reported to Prime Minister Srettha Thavisin who is on an official trip to Davos, Switzerland.
The prime minister expressed his condolences to the families of the victims and said he was shocked by the high number of fatalities.
He instructed the Interior Ministry to ensure that the injured people received proper treatment. The governor of Suphan Buri governor later reported to Interior Minister Anutin Charnvirakul that so far there was no survivor from the factory.
Srettha also instructed the Interior Ministry to update him about the tragedy every hour.
Traisulee Traisoranakul, secretary to Anutin, said the Suphanburi governor had reported the deadly accident to the interior minster.
Traisulee said Anutin was informed that the factory was located far from the local community.
She said the governor reported that there were over 20 workers in the factory and no survivor was found.
The factory had received its annual licence on August 24 last year.
Traisulee said Suphanburi officials and those from concerned government agencies were investigating the cause of the explosion.