Lithium-ion batteries have been making headlines for all the wrong reasons. The latest marquee moment involved a pair of exploding headphones on a plane. That incendiary incident came hot on the heels of Samsung’s Galaxy Note 7 (double) recall and major issues with “hoverboard” batteries. You can't chalk it all up to incompetence, either. Even rocket scientists have trouble keeping lithium-ion batteries in check.

By nature, lithium-ion batteries are dangerous. Inside, the main line of defense against short circuiting is a thin and porous slip of polypropylene that keeps the electrodes from touching. If that separator is breached, the electrodes come in contact, and things get very hot very quickly. The batteries are also filled with a flammable electrolyte, one that can combust when it heats up, then really get going once oxygen hits it. Not scary enough? That liquid is mixed with a compound that can burn your skin.

So why even use them? Lithium-ion batteries are incredibly efficient. They stuff freakish amounts of energy in a tiny package, one that can keep a phone or laptop running all day. Li-ion power cells are also a very mature technology. The first rechargeable lithium-ion batteries were used in Sony’s Handycams more than 25 years ago, and now there are dozens of battery suppliers around the world. If you're making a camera, car, plane, or fitness tracker, including a Li-ion cell is generally a plug-and-play step in the manufacturing process.

But unlike most mature tech, they seem to get more volatile as time goes on. That's because we demand higher-capacity batteries in slimmer packages at cheaper prices. The symptoms may be the same—they explode—but many factors are contributing to lithium-ion’s unwanted time in the spotlight.

Production Flaws

With all these exploding batteries, the no-brainer diagnosis is something must be wrong with the ways the battery is built. That is often the case, but as Samsung’s Note 7 saga shows, pinpointing the specific problem isn’t so simple. The initial recall involved phones with batteries made by Samsung itself, ones that didn't have enough space between the battery's protective pouch and electrodes inside. That squeeze bent the electrodes in some batteries, causing them to come into contact and short-circuit.

But once those phones were recalled, replacement devices with “safer” batteries from another company had separate issues. Many weren’t insulated well, while others had jagged edges inside that damaged the all-important separator. That also caused short circuiting, but for entirely different reasons.

Design Flaws

Most modern gadgets are designed to be as slim, light, and sleek as possible. That can wreak havoc on an otherwise well-built battery, especially a high-capacity cell packed into a small body. Pressure from the hardware surrounding the battery can cause damage to the electrodes or the separator and lead to short circuiting. Inadequate venting or thermal management can cause the flammable electrolyte inside the battery to heat up. Once it's too hot, chemical reactions can cause it to heat up even more and spiral out of control. It's a situation called thermal runaway that often ends in an explosion or fire—and then a bigger one once oxygen comes into contact with the chaos.

User-Supplied Damage

Even if a gadget is designed well, dropping it and subjecting it to long-term wear and tear can do damage to its volatile power source. The best way to tell if your battery is damaged is if it looks all puffed up—evidence that the chemicals inside the battery are producing gas in a way that they shouldn’t. That swelling also creates its own pressure with the battery housing, which could lead to a puncture or conflagration. Unfortunately, most phones these days have a sealed-in battery, and taking the device apart to inspect it involves breaking the warranty. If the external case of your phone appears to be pushing apart or feels abnormally hot to the touch, it’s best to be careful and bring it in for inspection.

Problems With the Charger

Think twice about picking up a cheap, no-name charging cable if you left yours at home. There’s a reason why some of those cables and wall warts are so cheap: To hit that crazy-low price, the companies that make them often skimp on insulation, shirk safety laws, and skip power-management features. It can lead to electrocution, an exploding charger, or an inferno in your phone.

Industry Pressure and Competition

If a company can save a few pennies on each battery, that can translate to millions or billions in profit. As a result, many lithium-ion battery manufacturers cut corners in order to price their cells more cheaply. The materials may have imperfections, causing damage in the already-thin separator. Maybe they can save a few bucks by skimping on insulation or quality control. These things were likely a major cause of those hoverboard fires: The first models on the market were expensive, and their popularity bred knockoffs with cheap prices and even cheaper internals. Crowdfunding and affordable components have democratized the consumer-electronics industry, but savings often come at the expense of safety.