Two explosions and a fire at a fireworks factory on the western outskirts of Indonesia's capital killed 47 people and injured dozens on Thursday, police said, and the death toll was expected to rise.

Thick plumes of dark smoke billowed from a factory warehouse in the Tangerang district, an industrial and manufacturing hub on the island of Java, TV broadcasts showed.

Hours later the burnt-out factory was still smouldering and there was a strong smell of burning plastic and chemicals.

Witnesses said there were two explosions, one at about 10 a.m. (0300 GMT) and another about three hours later, both of which could be heard miles away, media said.

A grisly video of the scene inside the warehouse, widely shared on social media, showed onlookers counting badly charred bodies.

"From the manifest we obtained, there were 103 workers. Of those 103 workers ... there were 46 who were injured," Jakarta police spokesman Argo Yuwono told Metro Television. "We also found some who had died. There are 47 bodies."

Yuwono said 10 people on the manifest unaccounted for may have left with light injuries or might not have been working at the time.

The online video and media images of the PT Panca Buana Cahaya Sukses warehouse showed smouldering ash and debris, with parts of the roof missing.

A search and rescue official, Deden Nurjaman, said bodies were still inside and he expected the death toll to climb.

"People were burned so badly you couldn’t see their faces... It was really bad," he said.

Industrial safety standards in Indonesia are often poor and rules weakly enforced. There have been a series of major fires this year, including one that engulfed one of Jakarta's main markets.

REPORTS OF UNDERAGE WORKERS

Manpower minister Hanif Dhakiri said he had asked his staff to investigate reports of underage workers at the factory.

"If there were underage workers that would be a violation," Dhakiri told reporters, adding he could revoke the company's permit.

One of the first policemen on the scene, Raymond Masengi, told Metro TV police had broken holes in the factory wall to help people escape.

At the scene of Thursday's disaster, the grass was scorched over an area about 10 metres (yards) from the site.

Forensic police worked in the fading light to examine the debris and were trying to set up floodlights as night fell.

A nearby mosque was holding prayers for the victims.

Fiza, a doctor in the emergency unit at Tangerang General Hospital, told Metro TV he was treating seven people, some of them with burns to more than 80 percent of their bodies. Three were in critical condition.

A witness who lives around the corner from the factory said she heard an explosion "like a roar".

"I dressed and stepped outside the house, and saw the flames, they were almost in my face. The smoke, the heat was in my face. I panicked, I was scared, I picked up my son and ran away from the fire," said Kartini, 40, who uses one name, like many Indonesians.

Hundreds of children at a school just 100 metres (yards) from the factory had to jump over school walls, dropping books and bags in their haste to get away.

"Everyone was panicking and running," said Kartini.

The factory had been operating for only two months, media said.

Fireworks are frequently used in Indonesia for religious and other celebrations, and are widely available.

"The fireworks factory is located near schools and settlements. That's wrong," Reinhart Wetik, an explosives expert, told Metro TV, adding there should have been special safety measures in place and trained staff.

"We are still looking into the cause of the fire," police spokesman Yuwono said, adding that for now police were prioritising evacuating victims.

Police were also investigating the factory's permit, he said.