Methodology
EV vs gas cost — methodology
The exact formulas, assumptions, default values and limitations behind the EV vs gas total-cost-of-ownership calculator.
Last updated
This documents the EV vs Gas Cost Calculator.
What this calculator does
It compares the cost to run an electric car against a gasoline car over a period you choose, and — if you supply purchase prices — works out when the EV repays any higher upfront cost. It also estimates the CO₂ you avoid each year.
The formulas
Annual energy and fuel
ev_energy_at_wheels = annual_miles / ev_miles_per_kwh
ev_energy_from_wall = ev_energy_at_wheels / charge_efficiency
gas_gallons = annual_miles / gas_mpg
We bill the EV on energy drawn from the wall, because that is what your meter records and what you pay for.
Annual cost and saving
ev_annual_fuel = ev_energy_from_wall * electricity_price_per_kwh
gas_annual_fuel = gas_gallons * gas_price_per_gallon
annual_saving = gas_annual_fuel - ev_annual_fuel
cost_per_mile = annual_fuel_cost / annual_miles (each vehicle)
Break-even (only when purchase prices are entered)
upfront_difference = ev_purchase_price - gas_purchase_price
breakeven_years = upfront_difference / annual_saving
We guard the division: if the EV is the same price or cheaper upfront it leads from year one; if it costs more to buy and more to run, it never breaks even on fuel and we report that honestly rather than showing a misleading number.
Emissions
co2_gas = gas_gallons * gasoline_co2_per_gallon
co2_ev = ev_energy_from_wall * grid_co2_per_kwh
co2_saved = co2_gas - co2_ev
Default values
Every default below is editable in the calculator and shown with its source in the calculator’s assumptions table. The two prices are the most time-sensitive — always replace them with your own.
Limitations — read these
- Fuel and purchase only. Maintenance, insurance, tax, incentives and resale value are not included. EVs typically have lower maintenance, and incentives can materially change the upfront gap — factor these in yourself. - Constant prices. We hold electricity and fuel prices flat over the comparison period. Real prices move; model a higher or lower price to see the sensitivity. - Representative grid average. The default grid carbon intensity is a US average. Your local grid may be cleaner or dirtier, which changes the CO₂ result.
How we keep it honest
The calculation logic lives in a small, pure function that is unit-tested against normal, edge and invalid inputs (for example, a zero fuel economy returns “no result” rather than infinity). If you spot an error, tell us and we’ll fix it.
Sources
Every default in this calculator traces to one of these.
- Average price of electricity to ultimate customers (residential)U.S. Energy Information Administration (EIA) · retrievedResidential prices vary by state and change monthly. Treat the default as representative and edit to your own rate.
- U.S. regular all-formulations retail gasoline pricesU.S. Energy Information Administration (EIA) · retrievedGasoline prices are volatile and regional. Default is a representative figure — edit to your local pump price.
- Greenhouse gas emissions from a typical passenger vehicle (8.887 kg CO₂ per gallon of gasoline)U.S. Environmental Protection Agency (EPA) · retrieved
- eGRID U.S. annual average CO₂ output emission rate for delivered electricityU.S. Environmental Protection Agency (EPA), eGRID · retrievedGrid carbon intensity varies widely by region; the default is the U.S. national average.
- Electricity (EV) — vehicle efficiency and charging lossesU.S. DOE Alternative Fuels Data Center (AFDC) · retrievedAC charging losses commonly add ~10–15% to energy drawn from the wall (charge efficiency ~0.85–0.90).
- Fuel economy ratings (mpg) and EV efficiency (mi/kWh)U.S. DOE / EPA — fueleconomy.gov · retrieved
By EnergyTally Team · Editorial & analysis team
- Published
- Updated
- Review
- EnergyTally Team,