A battery’s power comes from the tendency of electric charge to migrate between different substances. It is the power that Italian scientist Alessandro Volta sought to tap into when he built the first battery at the end of 1799.

Although different designs exist, the basic structure has remained the same ever since. Every battery has two electrodes. One, the anode, wants to give electrons (which carry a negative electric charge) to the other, the cathode. Connect the two through a circuit, and electrons will flow and carry out work—say, lighting a bulb or brushing your teeth.

Simply shifting electrons from one material to another, however, would not take you very far: like charges repel, and only so many electrons can accumulate on the cathode before they start to keep more electrons from joining. To keep the juice going, a battery balances the charges within its innards by moving positively charged ions from the anode to the cathode through an electrolyte, which can be solid, liquid or gelatinous. It is the electrolyte that makes the battery work, because it allows ions to flow but not electrons, whereas the external circuit allows electrons to flow but not ions.

For example, a charged lithium-ion battery—the type that powers cell phones and laptop computers—has a graphite anode stuffed with lithium atoms and a cathode made of some lithium-based substance. During operation, the anode's lithium atoms release electrons into the external circuit, where they reach the more electron-thirsty cathode. The lithium atoms stripped of their electrons thus become positively charged ions and are attracted toward the electrons accumulating in the cathode. They can do so by flowing through the electrolyte. The ions’ motion restores the imbalance of charges and allows the flow of electricity to continue—at least until the anode runs out of lithium.

Recharging the battery reverses the process: a voltage applied between the two electrodes makes the electrons (and the lithium ions) move to the graphite side. This is an uphill struggle, energetically speaking, which is why it amounts to storing energy in the battery.

When he built his first battery, Volta was trying to replicate the organs that produce electricity in torpedoes, the fish also known as electric rays, says Giuliano Pancaldi, a science historian at the University of Bologna in Italy.

Volta probably went by trial and error before settling on using metal electrodes and wet cardboard as an electrolyte. At the time, no one knew about the existence of atoms, ions and electrons. But whatever the nature of the charge carriers, Volta probably was not aware that in his battery, the positive charges moved in opposition to the “electric fluid” moving outside. “It took a century before experts reached a consensus on how the battery works,” Pancaldi says.