If you own a flashlight, a spare TV remote, or a talking teddy bear, you’ve almost certainly learned what happens when you leave alkaline batteries installed in a device for too long. It’s not pretty.

But what causes batteries to leak that crusty, white mess? 

To start, it helps to think of a battery as a tiny fuel tank built to house a chemical reaction. As the elements in that tank interact, generating power through use or self-discharge, the liquid electrolyte breaks down, releasing hydrogen gas. And gas—as we all know—creates pressure.

“It’s like water expanding,” says Prashant Kumta, Ph.D., a chemical and materials engineering professor at the University of Pittsburgh. “It can rupture the seals and cause a leak.”

The Great Escape

Once the insulating seals at the ends of the battery have been breached (in some cases, the outer steel canister might rust and corrode as well), the hydrogen escapes without notice. But the liquid electrolyte—in this case, potassium hydroxide—exits with it. Beware: Potassium hydroxide can cause eye, skin, and respiratory irritation. If you come in contact with it, rinse well and consult with a doctor to see whether you need medical care.

In general, though, the potassium hydroxide reaches the open air and reacts with carbon dioxide to form potassium carbonate—that white powder that cakes on the battery’s shell. “That’s one of the most stable compounds in the world,” says Venkat Viswanathan, Ph.D., an assistant professor of mechanical engineering at Carnegie Mellon University. “It’s essentially like rock salt.”

To be safe, you should still wear gloves when you handle the powder and refrain from breathing it in or eating it. As you’ve probably noticed, the potassium carbonate also has an adverse effect on the performance of your device.

So What Do You Do?

To clean a gadget caked with the aftermath of a leaking battery, dip a cotton swab in an acid such as lemon juice or distilled white vinegar and dab it on the potassium carbonate—that neutralizes it. Go slowly. You don’t want the acid to wreak havoc on the device’s other components. The liquid will start to fizzle as it interacts with the potassium carbonate. Once the white powder softens, you can gently rub it away with a cloth or toothbrush.

When you’ve finally restored your prized possession to working order, consider using lithium batteries in place of alkaline. They’re more expensive but far less prone to leaking and less likely to self-discharge, too.

For more tips and information, check our battery buying guide and Ratings.