Stanford University researchers have developed a fire extinguisher that prevents lithium-ion (Li-ion) battery fires before they start. If adopted widely, this failsafe could lead to more efficient power sources for smartphones and laptops without increasing their likelihood for detonation.

Li-ion batteries — a standard feature in most new, rechargeable technology — occasionally ignite when they charge or discharge too fast. If the ions within the battery move too fast, then the lithium plates build up heat. That heat can ignite the battery’s electrolyte. Boom!

The new invention is a capsule of the flame retardant triphenyl phosphate (TPP), surrounded by a plastic-like shell. Manufacturers would add these capsules to battery packs, and the shell would melts if things get too hot, releasing the flame retardant fluid. A description of the innovation was published today in Science Advances.

“I have been always interested in trying to solve the battery safety problem,” nanomaterials engineer and study leader Yi Cui said. “You look at the recent instance of the Samsung smartphone particularly. Battery safety is always a concern.”

Battery explosions, needless to say, can be dangerous. The Federal Aviation Administration ordered Boeing to ground a fleet of planes that posed a risk of battery fires in 2013. The Department of Transportation has banned Galaxy Note 7 smartphones on airplanes, after the device’s battery showed a tendency toward combustion in 2016. Also last year, a family sued Amazon on the allegation that a hoverboard exploded and burned down their house.

Still, electronics manufacturers love Li-ion batteries. Lithium is soft, highly reactive and lightweight — making it ideal for a rechargeable power source in small devices.

Jun Liu, a battery fellow at the Pacific Northwest National Laboratories, notes that there are billions of Li-ion batteries on the market that do their job without issue.

“Lithium batteries are no less safe than other technologies,” said Liu, who was not involved in the study. “Batteries are energetic devices. If you don’t handle them properly, they will give you problems.”

For instance, if a manufacturer warps a battery, or if a user overheats it, then it becomes more prone to incendiary reactions.

These developments are particularly important considering the rise in popularity of electric cars. If someone damaged their car battery, it would be much more dangerous than a small device like a cellphone.

Cui and his team aren’t the only ones trying to prevent battery fires. Some have tested putting flame retardant directly into the batteries, for example.

“Right now there is a huge effort made in the community to improve the safety of Li-ion batteries,” Liu said.