🛠️ToolsShed

Electric Charge Converter

Convert electric charge units between coulombs, milliampere-hours, microcoulombs, and more.

Result
0.2777777778 mAh

All Conversions

Coulomb (C)1
Millicoulomb (mC)1000
Microcoulomb (µC)1000000
Nanocoulomb (nC)1000000000
Picocoulomb (pC)1.000000e+12
Kilocoulomb (kC)0.001
Ampere-hour (Ah)0.0002777777778
Milliampere-hour (mAh)0.2777777778
Elementary Charge (e)6.241509e+18

Perguntas Frequentes

Implementação de Código

# Electric Charge Unit Converter
# Base unit: Coulomb (C)

CHARGE_TO_COULOMB = {
    "C":   1,
    "mC":  1e-3,
    "µC":  1e-6,
    "nC":  1e-9,
    "pC":  1e-12,
    "kC":  1e3,
    "MC":  1e6,
    "Ah":  3600,
    "mAh": 3.6,
    "e":   1.602176634e-19,  # Elementary charge
}

def convert_charge(value: float, from_unit: str, to_unit: str) -> float:
    """Convert electric charge between units."""
    if from_unit not in CHARGE_TO_COULOMB:
        raise ValueError(f"Unknown unit: {from_unit}")
    if to_unit not in CHARGE_TO_COULOMB:
        raise ValueError(f"Unknown unit: {to_unit}")

    coulombs = value * CHARGE_TO_COULOMB[from_unit]
    return coulombs / CHARGE_TO_COULOMB[to_unit]

# Examples
print(f"1 C = {convert_charge(1, 'C', 'µC'):.2e} µC")
print(f"1 Ah = {convert_charge(1, 'Ah', 'C'):.0f} C")
print(f"1 mAh = {convert_charge(1, 'mAh', 'C'):.1f} C")
print(f"1 µC = {convert_charge(1, 'µC', 'pC'):.0f} pC")
print(f"1 elementary charge = {1.602176634e-19:.3e} C")

Comments & Feedback

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