{
  "id": "battery-life",
  "version": "0a47a8446677",
  "status": "published",
  "name": "Battery Life Calculator",
  "question": "What is the battery life?",
  "summary": "Works out how long a battery runs a load: capacity in mAh ÷ current in mA, or capacity in Wh ÷ power in W, with an optional share of the capacity that is usable.",
  "category": "physics",
  "subcategory": "electricity",
  "url": "https://www.acalculator.org/physics/battery-life-calculator",
  "markdown": "https://www.acalculator.org/physics/battery-life-calculator.md",
  "kind": "function",
  "method": "Hours = capacity (mAh) ÷ 1,000 × usable share ÷ load (A), or capacity (Wh) × usable share ÷ load (W). Days = hours ÷ 24.",
  "assumptions": [
    "A steady average load. Real batteries give less at high currents and low temperatures (Peukert’s law), and less as they age; lower the usable share to allow for this.",
    "mAh mode assumes the load runs at the battery’s own voltage. For a device behind a voltage converter, use Wh and watts.",
    "Exact on the numbers as typed; rounded only to show."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "by": {
        "title": "I know",
        "description": "The capacity in mAh and the current, or the capacity in Wh and the power.",
        "type": "string",
        "enum": [
          "current",
          "power"
        ]
      },
      "mah": {
        "title": "Capacity (mAh)",
        "description": "The battery’s rated capacity in milliampere hours (1 Ah = 1,000 mAh).",
        "type": "number",
        "minimum": 0.001,
        "maximum": 1000000000
      },
      "i": {
        "title": "Load current",
        "description": "The average current the device draws.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "current",
        "minimum": 1e-9,
        "maximum": 100000
      },
      "wh": {
        "title": "Capacity",
        "description": "The battery’s rated energy in watt hours (or volts × amp hours).",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "energy",
        "minimum": 3.6,
        "maximum": 3600000000000
      },
      "p": {
        "title": "Load power",
        "description": "The average power the device uses.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "power",
        "minimum": 0.000001,
        "maximum": 1000000000
      },
      "u": {
        "title": "Usable capacity",
        "description": "The share of the rated capacity you expect to get out: 100% for the label value; less for age, cold, high loads or a converter.",
        "type": "number",
        "x-unit": "percent",
        "minimum": 1,
        "maximum": 100
      }
    }
  },
  "outputs": {
    "hours": {
      "label": "Battery life (hours)",
      "description": "Capacity × usable share ÷ load, in hours.",
      "format": "number"
    },
    "clock": {
      "label": "In days, hours and minutes",
      "description": "The battery life rounded half up to the whole minute.",
      "format": "text"
    },
    "days": {
      "label": "Battery life (days)",
      "description": "The hours ÷ 24.",
      "format": "number"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "by": "current",
      "mah": 2000,
      "i": "100 mA",
      "wh": "50 Wh",
      "p": "10 W",
      "u": 100
    },
    "outputs": {
      "hours": 20,
      "clock": "20 hours",
      "days": 0.8333333333333334
    },
    "text": "The battery lasts about 20 hours (20 hours)."
  },
  "examples": [
    {
      "given": {
        "by": "current",
        "mah": 2000,
        "i": 0.1,
        "u": 100
      },
      "expect": {
        "hours": 20,
        "clock": "20 hours",
        "days": 0.8333333333333334
      },
      "source": "Wikipedia, \"Ampere hour\" (a battery of C ampere hours supplies a current of I amperes for C ÷ I hours), https://en.wikipedia.org/wiki/Ampere_hour (retrieved 2026-10-05); hand calculation in content.mdx: 2,000 mAh ÷ 100 mA = 20 h"
    },
    {
      "given": {
        "by": "current",
        "mah": 3000,
        "i": 0.25,
        "u": 80
      },
      "expect": {
        "hours": 9.6,
        "clock": "9 hours, 36 minutes"
      },
      "source": "Wikipedia, \"Ampere hour\" (a battery of C ampere hours supplies a current of I amperes for C ÷ I hours), https://en.wikipedia.org/wiki/Ampere_hour (retrieved 2026-10-05); hand calculation in content.mdx: 3,000 × 0.8 ÷ 250 = 9.6 h"
    },
    {
      "given": {
        "by": "power",
        "wh": 180000,
        "p": 12,
        "u": 100
      },
      "expect": {
        "hours": 4.166666666666667,
        "clock": "4 hours, 10 minutes"
      },
      "source": "Wikipedia, \"Kilowatt-hour\" (energy = power × time; 1 Wh is 1 W for 1 hour), https://en.wikipedia.org/wiki/Kilowatt-hour (retrieved 2026-10-05); hand calculation in content.mdx: 50 Wh ÷ 12 W = 4.1667 h = 4 h 10 min"
    },
    {
      "given": {
        "by": "current",
        "mah": 220,
        "i": 0.000015,
        "u": 100
      },
      "expect": {
        "hours": 14666.666666666666,
        "clock": "611 days, 2 hours, 40 minutes"
      },
      "source": "Wikipedia, \"Ampere hour\" (a battery of C ampere hours supplies a current of I amperes for C ÷ I hours), https://en.wikipedia.org/wiki/Ampere_hour (retrieved 2026-10-05); hand calculation in content.mdx: 220 mAh ÷ 0.015 mA = 14,666.67 h"
    }
  ],
  "sources": [
    "Wikipedia, \"Ampere hour\": a battery of C ampere hours supplies I amperes for C ÷ I hours. https://en.wikipedia.org/wiki/Ampere_hour (retrieved 2026-10-05)",
    "Wikipedia, \"Kilowatt-hour\": energy = power × time; 1 Wh is 1 watt for 1 hour (3,600 J). https://en.wikipedia.org/wiki/Kilowatt-hour (retrieved 2026-10-05)",
    "Wikipedia, \"Peukert’s law\": capacity falls at higher discharge rates. https://en.wikipedia.org/wiki/Peukert%27s_law (retrieved 2026-10-05)"
  ],
  "related": [
    "amp",
    "wattage",
    "power"
  ],
  "changelog": []
}
