In electronics, a battery or voltaic cell is a combination of one or more electrochemical Galvanic cells which store chemical energy that can be converted into electric potential energy, creating electricity. Since the invention of the first Voltaic pile in 1800 by Alessandro Volta, the battery has become a common power source for many household and industrial applications, and is now a multi-billion dollar industry.
The name "battery" was coined by Benjamin Franklin for an arrangement of multiple Leyden jars (an early type of capacitor) after a battery of cannon. Common usage includes a single electrical cell in the definition. 
See main article: History of the battery.
An early form of electrochemical battery called the Baghdad Battery may have been used in antiquity. However, the modern development of batteries started with the Voltaic pile, invented by the Italian physicist Alessandro Volta in 1800.
In 1791, Luigi Galvani published a report on "animal electricity." He created an electric circuit consisting of two different metals, with one touching a frog's leg and the other touching both the leg and the first metal, thus closing the circuit. In modern terms, the frog's leg served as both the electrolyte and the sensor, and the metals served as electrodes. He noticed that even though the frog was dead, its legs would twitch when he touched them with the metals.
Within a year, Volta realized the frog's moist tissues could be replaced by cardboard soaked in salt water, and the frog's muscular response could be replaced by another form of electrical detection. He already had studied the electrostatic phenomenon of capacitance, which required measurements of electric charge and of electrical potential ("tension"). Building on this experience, Volta was able to detect electric current through his system, also called a Galvanic cell. The terminal voltage of a cell that is not discharging is called its electromotive force (emf), and has the same unit as electrical potential, named (voltage) and measured in volts, in honor of Volta. In 1800, Volta invented the battery by placing many voltaic cells in series, literally piling them one above the other. This Voltaic pile gave a greatly enhanced net emf for the combination, with a voltage of about 50 volts for a 32-cell pile. In many parts of Europe batteries continue to be called piles. 
Volta did not appreciate that the voltage was due to chemical reactions. He thought that his cells were an inexhaustible source of energy, and that the associated chemical effects (e.g. corrosion) were a mere nuisance, rather than an unavoidable consequence of their operation, as Michael Faraday showed in 1834. According to Faraday, cations (positively charged ions) are attracted to the cathode, and anions (negatively charged ions) are attracted to the anode.
Although early batteries were of great value for experimental purposes, in practice their voltages fluctuated and they could not provide a large current for a sustained period. Later, starting with the Daniell cell in 1836, batteries provided more reliable currents and were adopted by industry for use in stationary devices, particularly in telegraph networks where they were the only practical source of electricity, since electrical distribution networks did not then exist. These wet cells used liquid electrolytes, which were prone to leakage and spillage if not handled correctly. Many used glass jars to hold their components, which made them fragile. These characteristics made wet cells unsuitable for portable appliances. Near the end of the nineteenth century, the invention of dry cell batteries, which replaced the liquid electrolyte with a paste, made portable electrical devices practical.
Since then, batteries have gained popularity as they became portable and useful for a variety of purposes. According to a 2005 estimate, the worldwide battery industry generates US$48 billion in sales each year, with 6% annual growth.
See main article: Electrochemical cell.
A battery must be in a circuit for the circuit to work. A battery is a device that converts chemical energy directly to electrical energy. It consists of one or more voltaic cells. Each voltaic cell consists of two half cells connected in series by a conductive electrolyte containing anions and cations. One half-cell includes electrolyte and the electrode to which anions (negatively-charged ions) migrate, i.e. the anode or negative electrode; the other half-cell includes electrolyte and the electrode to which cations (positively-charged ions) migrate, i.e. the cathode or positive electrode. In the redox reaction that powers the battery, reduction (addition of electrons) occurs to cations at the cathode, while oxidation (removal of electrons) occurs to anions at the anode. The electrodes do not touch each other but are electrically connected by the electrolyte, which can be either solid or liquid. Many cells use two half-cells with different electrolytes. In that case each half-cell is enclosed in a container, and a separator that is porous to ions but not the bulk of the electrolytes prevents mixing.
Each half cell has an electromotive force (or emf), determined by its ability to drive electric current from the interior to the exterior of the cell. The net emf of the battery is the difference between the emfs of its half-cells, as first recognized by Volta. Thus, if the electrodes have emfs
The electrical potential difference, or
As stated above, the voltage developed across a cell's terminals depends on the energy release of the chemical reactions of its electrodes and electrolyte. Alkaline and carbon-zinc cells have different chemistries but approximately the same emf of 1.5 volts; likewise NiCd and NiMH cells have different chemistries, but approximately the same emf of 1.2 volts. On the other hand the high electrochemical potential changes in the reactions of lithium compounds give lithium cells emfs of 3 volts or more.
See main article: List of battery types.
There are many general types of electrochemical cells, including galvanic cells, electrolytic cells, fuel cells, flow cells and voltaic piles. A battery's characteristics may vary due to many factors including internal chemistry, current drain and temperature.
Batteries are classified into two broad categories, each type with advantages and disadvantages.
Historically, some types of primary batteries used, for example, for telegraph circuits, were restored to operation by replacing the components of the battery consumed by the chemical reaction.  Secondary batteries are not indefinitely rechargeable due to dissipation of the active materials, loss of electrolyte and internal corrosion.
Primary batteries can produce current immediately on assembly. Disposable batteries, also called primary cells, are intended to be used once and discarded. These are most commonly used in portable devices that have low current drain, are only used intermittently, or are used well away from an alternative power source, such as in alarm and communication circuits where other electric power is only intermittently available. Disposable primary cells cannot be reliably recharged, since the chemical reactions are not easily reversible and active materials may not return to their original forms. Battery manufacturers recommend against attempting to recharge primary cells.
Common types of disposable batteries include zinc-carbon batteries and alkaline batteries. Generally, these have higher energy densities than rechargeable batteries, but disposable batteries do not fare well under high-drain applications with loads under 75 ohms (75 Ω).
See main article: Rechargeable battery.
Secondary batteries must be charged before use; they are usually assembled with active materials in the discharged state. Rechargeable batteries or secondary cells can be recharged by applying electrical current, which reverses the chemical reactions that occur during its use. Devices to supply the appropriate current are called chargers or rechargers.
The oldest form of rechargeable battery is the lead-acid battery, a type of wet cell. This battery is notable in that it contains a liquid in an unsealed container, requiring that the battery be kept upright and the area be well ventilated to ensure safe dispersal of the hydrogen gas produced by these batteries during overcharging. The lead-acid battery is also very heavy for the amount of electrical energy it can supply. Despite this, its low manufacturing cost and its high surge current levels make its use common where a large capacity (over approximately 10Ah) is required or where the weight and ease of handling are not concerns.
A common form of the lead-acid battery is the modern car battery, which can generally deliver a peak current of 450 amperes.  An improved type of liquid electrolyte battery is the sealed valve regulated lead acid (VRLA) battery, popular in the automotive industry as a replacement for the lead-acid wet cell. The VRLA battery uses an immobilized sulfuric acid electrolyte, reducing the chance of leakage and extending shelf life. VRLA batteries have the electrolyte immobilized, usually by one of two means:
Other portable rechargeable batteries include several "dry cell" types, which are sealed units and are therefore useful in appliances such as mobile phones and laptop computers. Cells of this type (in order of increasing power density and cost) include nickel-cadmium (NiCd), nickel metal hydride (NiMH) and lithium-ion (Li-ion) cells. By far, Li-ion has the highest share of the dry cell rechargeable market. Meanwhile, NiMH has replaced NiCd in most applications due to its higher capacity, but NiCd remains in use in power tools, two-way radios, and medical equipment.
Recent developments include batteries with embedded functionality such as USBCELL, with a built-in charger and USB connector within the AA format, enabling the battery to be charged by plugging into a USB port without a charger, and low self-discharge (LSD) mix chemistries such as Hybrio, ReCyko, and Eneloop, where cells are precharged prior to shipping.
The more electrolyte and electrode material there is in the cell, the greater the capacity of the cell. Thus a small cell has less capacity than a larger cell, given the same chemistry (e.g. alkaline cells), though they develop the same open-circuit voltage.
Because of the chemical reactions within the cells, the capacity of a battery depends on the discharge conditions such as the magnitude of the current, the duration of the current, the allowable terminal voltage of the battery, temperature and other factors. The available capacity of a battery depends upon the rate at which it is discharged. If a battery is discharged at a relatively high rate, the available capacity will be lower than expected.
The battery capacity that battery manufacturers print on a battery is the product of 20 hours multiplied by the maximum constant current that a new battery can supply for 20 hours at 68 F° (20 C°), down to a predetermined terminal voltage per cell. A battery rated at 100 A·h will deliver 5 A over a 20 hour period at room temperature. However, if it is instead discharged at 50 A, it will run out of charge before the 2 hours as theoretically expected.
For this reason, a battery capacity rating is always related to an expected discharge duration.
The relationship between current, discharge time, and capacity for a lead acid battery is expressed by Peukert's law. Theoretically, a battery should provide the same amount of energy regardless of the discharge rate, but in real batteries, internal energy losses cause the efficiency of a battery to vary at different discharge rates. When discharging at low rate, the battery's energy is delivered more efficiently than at higher discharge rates.
In general, the higher the ampere-hour rating, the longer the battery will last for a certain load. Installing batteries with different A·h ratings will not affect the operation of a device rated for a specific voltage unless the load limits of the battery are exceeded. Theoretically, a battery would operate at its A·h rating, but realistically, high-drain loads like digital cameras can result in lower actual energy, most notably for alkaline batteries. For example, a battery rated at 2000 mA·h may not sustain a current of 1 A for the full two hours.
Even if never taken out of the original package, disposable (or "primary") batteries can lose 8 to 20 percent of their original charge every year at a temperature of about 20° - 30°C. This is known as the "self discharge" rate and is due to non-current-producing "side" chemical reactions, which occur within the cell even if no load is applied to it. The rate of the side reactions is reduced if the batteries are stored at low temperature, although some batteries can be damaged by freezing. High or low temperatures may reduce battery performance. This will affect the initial voltage of the battery. For an AA alkaline battery this initial voltage is approximately normally distributed around 1.6 volts.
Discharging performance of all batteries drops at low temperature.
Rechargeable batteries traditionally self-discharge more rapidly than disposable alkaline batteries, especially nickel-based batteries; a freshly charged NiCd loses 10% of its charge in the first 24 hours, and thereafter discharges at a rate of about 10% a month. However, modern lithium designs have reduced the self-discharge rate to a relatively low level (but still poorer than for primary batteries). Most nickel-based batteries are partially discharged when purchased, and must be charged before first use.
Although rechargeable batteries may be refreshed by charging, they still suffer degradation through usage. Low-capacity nickel metal hydride (NiMH) batteries (1700-2000 mA·h) can be charged for about 1000 cycles, whereas high capacity NiMH batteries (above 2500 mA·h) can be charged for about 500 cycles. Nickel cadmium (NiCd) batteries tend to be rated for 1,000 cycles before their internal resistance increases beyond usable values. Normally a fast charge, rather than a slow overnight charge, will result in a shorter battery lifespan. However, if the overnight charger is not "smart" and cannot detect when the battery is fully charged, then overcharging is likely, which will damage the battery. Degradation usually occurs because electrolyte migrates away from the electrodes or because active material falls off the electrodes. NiCd batteries suffer the drawback that they should be fully discharged before recharge. Without full discharge, crystals may build up on the electrodes, thus decreasing the active surface area and increasing internal resistance. This decreases battery capacity and causes the dreaded "memory effect". These electrode crystals can also penetrate the electrolyte separator, thereby causing shorts. NiMH, although similar in chemistry, does not suffer from "memory effect" to quite this extent. When a battery reaches the end of its lifetime, it will not suddenly lose all of its capacity; rather, its capacity will gradually decrease. 
Automotive lead-acid rechargeable batteries have a much harder life. Because of vibration, shock, heat, cold, and sulfation of their lead plates, few automotive batteries last beyond six years of regular use. Automotive starting batteries have many thin plates to provide as much current as possible in a reasonably small package. In general, the thicker the plates, the longer the life of the battery. Typically they are only drained a small amount before recharge. Care should be taken to avoid deep discharging a starting battery, since each charge and discharge cycle causes active material to be shed from the plates.
"Deep-cycle" lead-acid batteries such as those used in electric golf carts have much thicker plates to aid their longevity. The main benefit of the lead-acid battery is its low cost; the main drawbacks are its large size and weight for a given capacity and voltage. Lead-acid batteries should never be discharged to below 20% of their full capacity, because internal resistance will cause heat and damage when they are recharged. Deep-cycle lead-acid systems often use a low-charge warning light or a low-charge power cut-off switch to prevent the type of damage that will shorten the battery's life.
Battery life can be extended by storing the batteries at a low temperature, as in a refrigerator or freezer, because the chemical reactions in the batteries are slower. Such storage can extend the life of alkaline batteries by ~5%; while the charge of rechargeable batteries can be extended from a few days up to several months. In order to reach their maximum voltage, batteries must be returned to room temperature; discharging an alkaline battery at 250 mAH at 0°C is only half as efficient as it is at 20°C. As a result, alkaline battery manufacturers like Duracell do not recommend refrigerating or freezing batteries.
A battery explosion is caused by the misuse or malfunction of a battery, such as attempting to recharge a primary (non-rechargeable) battery, or short circuiting a battery. With car batteries, explosions are most likely to occur when a short circuit generates very large currents. In addition, car batteries liberate hydrogen when they are overcharged (because of electrolysis of the water in the electrolyte). Normally the amount of overcharging is very small, as is the amount of explosive gas developed, and the gas dissipates quickly. However, when "jumping" a car battery, the high current can cause the rapid release of large volumes of hydrogen, which can be ignited by a nearby spark (for example, when removing the jumper cables).
When a battery is recharged at an excessive rate, an explosive gas mixture of hydrogen and oxygen may be produced faster than it can escape from within the walls of the battery, leading to pressure build-up and the possibility of the battery case bursting. In extreme cases, the battery acid may spray violently from the casing of the battery and cause injury. Overcharging - that is, attempting to charge a battery beyond its electrical capacity - can also lead to a battery explosion, leakage, or irreversible damage to the battery. It may also cause damage to the charger or device in which the overcharged battery is later used. Additionally, disposing of a battery in fire may cause an explosion as steam builds up within the sealed case of the battery.
The widespread use of batteries has created many environmental concerns, such as toxic metal pollution. Battery manufacture consumes resources and often involves hazardous chemicals. Used batteries also contribute to electronic waste. Some areas now have battery recycling services available to recover some of the materials from used batteries. Batteries may be harmful or fatal if swallowed. Recycling or proper disposal prevents dangerous elements (such as lead, mercury, and cadmium) found in some types of batteries from entering the environment. In the United States, Americans purchase nearly three billion batteries annually, and about 179,000 tons of those end up in landfills across the country.
In the United States, the Mercury-Containing and Rechargeable Battery Management Act of 1996 banned the sale of mercury-containing batteries (except small button cell batteries), enacted uniform labeling requirements for rechargeable batteries, and required that rechargeable batteries be easily removable. California, and New York City prohibit the disposal of rechargeable batteries in solid waste, and along with Maine require recycling of cell phones. The rechargeable battery industry has nationwide recycling programs in the United States and Canada, with dropoff points at local retailers.
The Battery Directive of the European Union has similar requirements, in addition to requiring increased recycling of batteries, and promoting research on improved battery recycling methods.