Laptops and desktops both run on electricity. Both have small batteries to maintain the real-time clock and, in some cases, CMOS RAM. However, unlike a desktop computer, a laptop is portable and can run on batteries alone.
Nickel-Cadmium (NiCad) batteries were the first type of battery commonly used in laptop computers, and older laptops sometimes still use them. They have a life of roughly two hours between charges, but this life decreases with each charge based on the memory effect. Gas bubbles form in the cell plates, reducing the total amount of available cell space for recharge. The only way around this is to discharge the battery completely before recharging it. The other drawback of NiCad is that if the battery charges too long, it can explode.
Nickel-Metal Hydride (NiMH) batteries are the bridge between NiCad and the newer Lithium-Ion (LiIon) batteries. They last longer between charges than NiCad but overall have a shorter total lifespan. They suffer from the memory effect, but to a lesser extent than NiCad batteries.
LiIon batteries are the current standard for laptop computers. They are light and have long life spans. They do not suffer from the memory effect, can be charged randomly, and won't overheat if overcharged. They are also thinner than any other battery available for laptops, making them ideal for the new ultra-thin notebooks. LiIon batteries can last for anything from about 950 up to 1200 charges.
Many laptops with LiIon batteries claim to have a 5-hour battery life, but this measurement can vary greatly depending on how the computer is used. The hard drive, other disk drives and LCD display all use substantial battery power. Even maintaining wireless Internet connectivity requires some battery power. Many laptop computer models have power management software to extend the battery life or conserve battery power when the battery is low.