Skip to content
🛠️ToolsShed

Battery Capacity Converter

Convert battery capacity between mAh, Ah, Wh, and kWh with voltage selection.

mAh (Milliampere-hour)

5,000

Ah (Ampere-hour)

5

Wh (Watt-hour)

18.5

kWh (Kilowatt-hour)

0.0185

Formulas

Wh = (mAh × V) ÷ 1000

Ah = mAh ÷ 1000

Calculated using 3.7V reference voltage

About this tool

Battery capacity represents the amount of electrical energy a battery can store and deliver. Understanding battery capacity is essential in our increasingly mobile world, where smartphones, laptops, power banks, and electric vehicles depend on reliable energy measurements. This tool simplifies the conversion between mAh (milliampere-hours), Ah (ampere-hours), Wh (watt-hours), and kWh (kilowatt-hours)—the four most common units used to describe battery capacity across consumer electronics, automotive, and renewable energy applications.

Whether you're shopping for a new device, comparing battery specifications across products, or working on electrical projects, knowing how to convert between capacity units helps you make informed decisions. Engineers designing electronic products need to specify batteries in units appropriate to their industry, while consumers comparing portable chargers or electric vehicles benefit from understanding energy measurements. The tool automatically accounts for voltage, which is critical because the same mAh rating at different voltages stores different amounts of energy.

This converter is indispensable for anyone involved with battery technology: electrical engineers optimizing power systems, product managers selecting batteries for devices, students learning about energy storage, and consumers evaluating battery options. The tool works with standard voltages from Li-ion phones to lead-acid vehicles and scales from small consumer batteries to large-capacity storage systems, making it useful across virtually every domain where batteries play a role.

Frequently Asked Questions

Code Implementation

def convert_battery_capacity(value: float, from_unit: str, to_unit: str,
                               voltage: float = 3.7) -> float:
    """
    Convert battery capacity between mAh, Ah, Wh, kWh.
    voltage is required for mAh/Ah <-> Wh/kWh conversions.
    """
    # Convert to milliwatt-hours as base
    if from_unit == "mAh":
        base_mwh = value * voltage
    elif from_unit == "Ah":
        base_mwh = value * 1000 * voltage
    elif from_unit == "Wh":
        base_mwh = value * 1000
    elif from_unit == "kWh":
        base_mwh = value * 1_000_000
    else:
        raise ValueError(f"Unknown unit: {from_unit}")

    if to_unit == "mAh":
        return base_mwh / voltage
    elif to_unit == "Ah":
        return base_mwh / (1000 * voltage)
    elif to_unit == "Wh":
        return base_mwh / 1000
    elif to_unit == "kWh":
        return base_mwh / 1_000_000
    else:
        raise ValueError(f"Unknown unit: {to_unit}")

# Examples
print(f"5000 mAh @ 3.7V = {convert_battery_capacity(5000, 'mAh', 'Wh'):.2f} Wh")
print(f"18.5 Wh = {convert_battery_capacity(18.5, 'Wh', 'mAh'):.0f} mAh @ 3.7V")
print(f"100 Wh = {convert_battery_capacity(100, 'Wh', 'kWh'):.4f} kWh")

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.