How long will a battery last? To a first approximation, divide its capacity by the current the device draws: a 3,000 mAh battery feeding a 150 mA load lasts 20 hours. Real batteries rarely deliver every last milliamp-hour, though. Their voltage sags towards the end, converters waste a little energy, cold weather and age cut capacity, and deep discharges shorten the life of lithium and lead-acid cells.
That is why the calculator applies a discharge safety margin. Keeping 20% in reserve (a usable share of 80%) is a sensible default for lithium-ion batteries; lead-acid batteries last longest if you use only about half their capacity.
Many battery-powered gadgets do not draw a constant current. An Arduino or ESP32 sensor might wake for 2 seconds at 150 mA to take a reading and transmit it, then sleep for minutes at a few microamps. Choosing the awake/sleep mode lets you enter both currents and times; the calculator works out the time-weighted average current, which is what really sets battery life. Cutting the awake time or the sleep current often stretches a project from days to months.
How to use the Battery Life Calculator
- Battery capacity
- Device usage
- Current draw (awake current in sleep-cycle mode)
- Awake time per cycle
- Sleep time per cycle
- Sleep current
- Usable share of capacity (100% − safety margin): 80% keeps a 20% reserve, a good default for lithium batteries. Use about 50% for lead-acid.
- Battery voltage (for energy)
Results update as you type, every field has its own unit menu, and everything is calculated in your browser.
How it works
Enter the battery capacity and the device’s current draw, or its awake and sleep currents and times. The calculator finds the average current, divides the capacity by it and multiplies by the usable share of the capacity.
Worked example
A 3,000 mAh battery powers a device drawing 150 mA. With an 80% usable share it lasts 3,000 ÷ 150 × 0.8 = 16 hours. If the device instead wakes for 2 s at 150 mA and sleeps for 8 s at 50 µA, the average current is (150 × 2 + 0.05 × 8) ÷ 10 = 30.04 mA, and the battery lasts 3,000 ÷ 30.04 × 0.8 = 79.9 hours, about 3.3 days.
Recommended usable share
| Battery type | Usable share | Why |
|---|---|---|
| Lithium-ion / LiPo | 80% | Avoids the low-voltage cut-off and extends cycle life |
| LiFePO4 | 80–90% | Tolerates deep discharge well |
| Lead-acid (AGM, flooded) | 50% | Deep discharge sharply shortens its life |
| Alkaline (AA, AAA) | 70–90% | Voltage sags steadily as it discharges |
Inputs explained
| Field | What to enter |
|---|---|
| Battery capacity | Units: mAh, Ah |
| Device usage | Choose one: Constant current draw, Awake / sleep cycle (microcontrollers, sensors) |
| Current draw (awake current in sleep-cycle mode) | Units: mA, A, µA |
| Awake time per cycle | Units: s, ms, min |
| Sleep time per cycle | Units: s, ms, min, h |
| Sleep current | Units: µA, mA |
| Usable share of capacity (100% − safety margin) | In %. 80% keeps a 20% reserve, a good default for lithium batteries. Use about 50% for lead-acid. |
| Battery voltage (for energy) | In V |
What each result means
- Estimated battery life = [Battery capacity]÷[Average current]×[Usable share of capacity (100% − safety margin)]÷100
- In hours = [Battery capacity]÷[Average current]×[Usable share of capacity (100% − safety margin)]÷100
- In days = [In hours]÷24
- Runtime with no safety margin = [Battery capacity]÷[Average current]
- Usable energy = [Battery capacity]×[Usable share of capacity (100% − safety margin)]÷100×[Battery voltage (for energy)]÷1000
Formula
Battery life (h) = capacity (mAh) ÷ average current (mA) × usable share · Sleep cycle: average current = (I_awake × t_awake + I_sleep × t_sleep) ÷ (t_awake + t_sleep)
Worked example
Inputs: Battery capacity: 3,000 mAh; Device usage: Constant current draw; Current draw (awake current in sleep-cycle mode): 150 mA; Usable share of capacity (100% − safety margin): 80 %; Battery voltage (for energy): 3.7 V.
Results: Average current = 150 mA; Estimated battery life = 16 h 0 min; In hours = 16 h; In days = 0.67 days; Runtime with no safety margin = 20 h; Usable energy = 8.88 Wh.
Key terms
- Capacity (mAh)
- Charge a battery can deliver: 1 mAh is 1 mA for 1 hour.
- Average current
- Time-weighted mean current over a full awake–sleep cycle.
- Discharge safety margin
- Share of capacity deliberately left unused to protect the battery and allow for losses.
- Sleep current
- Current drawn in a low-power standby mode, often a few microamps.
Frequently asked questions
How long will a 3,000 mAh battery last?
At 150 mA about 20 hours in theory, or 16 hours keeping a 20% reserve.
How do I convert Wh to mAh?
mAh = Wh × 1000 ÷ voltage. A 10 Wh battery at 3.7 V is about 2,700 mAh.
Why keep a discharge safety margin?
Voltage drops near empty, devices shut down early, and deep discharges wear out lithium and lead-acid cells faster.
How do I measure my device's current?
Put a multimeter in series with the battery, or use a USB power meter for USB devices; average the reading over a typical usage cycle.
How can I make a microcontroller project last longer?
Use deep sleep, shorten the awake time, power sensors only when needed and remove LEDs and linear regulators with high quiescent current.
Does temperature affect battery life?
Yes, below about 0 °C lithium and alkaline cells can lose 20–50% of their capacity.
Does a bigger battery voltage change the result?
Not the hours, if the current is measured at the battery; voltage matters only for converting to watt-hours.