Enter your distance per month, the gas car's fuel economy and gas price, and the EV's efficiency and electricity rate. The charging loss and the price difference are optional (enter the price difference to also get the payback period).
Table of Contents
-
What you can do on this page
-
What is this calculation used for?
-
How to Use
-
Formula
-
Symbols and terms
-
Good to know before you start
-
How to calculate it in Excel
-
How to calculate it in Google Sheets
-
How to calculate it in Python
-
How to write it in LaTeX and other math languages (copy and paste)
-
How to have ChatGPT do the calculation
-
DataChef Features
-
Related Features
-
NumberChef Calculators List
What you can do on this page
- Enter your miles per month, the gas car's fuel economy (mpg), the gas price ($ per gallon), the EV's efficiency (mi/kWh) and your electricity rate ($ per kWh), and you get the cost per mile of each car, the monthly and yearly fuel (electricity) cost and the difference on the spot
- Enter the EV's charging loss (the part of the electricity you buy that does not reach the battery) to compare with the electricity cost you actually pay (a blank counts as 10%)
- Enter the price difference (EV price − gas car price) to also get the simple payback period, the years it takes for the fuel savings to earn back the price gap, and a graph of total cost over the years (the point where the two lines cross is the payback year)
- A plain-language explanation of the formulas and copy-and-paste formulas for Excel, Google Sheets and Python are all on this page
What is this calculation used for?
If you drive 1,000 miles a month and compare a 25 mpg car with gas at $3.20 a gallon against an EV that gets 3.5 mi/kWh at $0.17 per kWh with 10% loss, the cost per mile is $0.128 for the gas car and about $0.054 for the EV. The yearly fuel cost is $1,536 for the gas car and about $648 for the EV, a difference of about $888 a year (all are calculations for these inputs).
Looking at the yearly amount, not "how much less per month", makes it easier to compare with the price difference and other running costs. If the EV costs $8,000 more, it takes about 9.0 years for the fuel savings alone to earn back the price gap, which you can weigh against how long you plan to keep the car.
With the same two cars, someone who drives only 400 miles a month has a yearly difference of about $355, so earning back an $8,000 price gap would take about 22.5 years. On the other hand, someone who drives 3,000 miles a month, like a rideshare or sales driver, has a difference of about $2,665 a year and earns it back in about 3.0 years.
The fuel cost difference is proportional to the miles driven, so "how many miles you drive a year" decides whether you get the benefit of the EV's lower fuel cost. For the same pair of cars, the size of the difference is very different for someone who drives only on weekends and someone who drives long distances every day.
Many utilities offer time-of-use or EV plans with cheaper rates at night. For example, if you can charge at $0.10 per kWh, the EV's yearly electricity cost at 1,000 miles a month, 3.5 mi/kWh and 10% loss is about $381, and the difference from the gas car (25 mpg at $3.20 a gallon, $1,536 a year) grows to about $1,155 a year (the rates are examples; check your own plan).
On the other hand, if you cannot charge at home and mostly use DC fast chargers at a high rate (for example, $0.45 per kWh), the EV's yearly electricity cost is about $1,714, about $178 more than the gas car. Where you charge and at what rate has a big effect on the EV's fuel cost.
Comparing a 40 mpg hybrid (gas at $3.20 a gallon) with an EV that gets 4 mi/kWh ($0.15 per kWh, 10% loss) at 600 miles a month, the yearly fuel cost is $576 for the hybrid and $300 for the EV, a difference of $276 a year. If the EV costs $6,000 more, the fuel savings alone would take about 21.7 years to earn it back, so you would decide based on things other than fuel as well (tax credits and rebates, registration fees, maintenance, battery warranty, resale value, the effort of charging, quietness and so on).
The result on this page is "the difference in fuel cost only", so add or subtract the other costs separately. Fuel is the main difference for people who drive a lot; for people who drive little, the other factors matter more.
A business with several company cars estimates the fuel cost at 2,000 miles a month per car: a gas car (20 mpg at $3.20 a gallon) costs about $3,840 a year, and an EV (3 mi/kWh at $0.15 per kWh with 10% loss) costs about $1,333 a year. Multiply by the number of vehicles to see how much the choice of vehicle changes the yearly fuel budget.
For a household too, "gas" in the budget turns into "electricity" with an EV, so estimating the yearly amount in advance shows how your budget will change after switching. Gas prices and electricity rates change, so updating the inputs once a year keeps the estimate current.
Formula
Symbols and terms
Symbols
| \(p\) | Gas price ($ per gallon). The price of 1 gallon of gas. It is the first letter of "price". |
| \(f\) | The gas car's fuel economy (mpg), how many miles it goes on 1 gallon. It is the first letter of "fuel economy". |
| \(c_g\) | The gas car's fuel cost per mile ($ per mile). \(c\) stands for "cost", and the small \(g\) for "gasoline". |
| \(u\) | Electricity rate. The price of 1 kWh ($ per kWh). It is the first letter of "unit price". |
| \(L\) | Charging loss (%). The share of the electricity you buy that does not reach the battery. It is the first letter of "loss". |
| \(\eta\) | The EV's efficiency (mi/kWh), how far it goes on 1 kWh. The Greek letter eta is often used for efficiency; here it shows how well the car turns electricity into distance. |
| \(c_e\) | The EV's electricity cost per mile ($ per mile). The small \(e\) stands for "electric". |
| \(d\) | Miles per month. It is the first letter of "distance". |
| \(G\) | The gas car's yearly fuel cost ($). It is the first letter of "gasoline". |
| \(E\) | The EV's yearly electricity cost ($). It is the first letter of "electric". |
| \(\Delta\) | Yearly difference ($) = gas car yearly fuel cost − EV yearly electricity cost. The Greek letter delta is often used for a difference or a change (it matches D, the first letter of "difference"). |
| \(\Delta P\) | Price difference ($) = EV price − gas car price. \(P\) stands for "price", and \(\Delta\) is added because it is a difference. |
| \(T\) | Simple payback period (years). It is the first letter of "time". |
Terms
| fuel economy | How many miles a car goes on 1 gallon of fuel (mpg). The larger the number, the better the car uses fuel. The EPA rating (measured in standard tests) and the value you get in real driving often differ; you can measure your own real-world mpg with the fill-up method (miles from one full tank to the next ÷ gallons added). |
| efficiency | How far an EV goes on 1 kWh (mi/kWh), the EV version of mpg. The larger the number, the better the car uses electricity. The EPA label shows it as kWh per 100 miles instead. It changes with the car, speed, heating and temperature, and tends to drop in winter. |
| kWh (kilowatt-hour) | A unit of electrical energy. Using 1 kW of power for 1 hour uses 1 kWh. Both EV battery sizes and electric bills are counted in this unit. |
| charging loss | The part of the electricity you buy that is lost, mostly as heat, before it reaches the battery. The main causes are the onboard charger, which turns AC into DC, and the cooling and control systems that run while charging. About 10% is typical for Level 2 charging at home. |
| electricity rate | The price of 1 kWh of electricity ($ per kWh). It depends on your utility, your plan, how much you use and, on time-of-use plans, the time of day. Divide your bill by the kWh used to find your home's rough average rate. |
| running costs | The costs of keeping a car every year. Besides fuel, they include registration fees and taxes, insurance, maintenance, tires, parking and so on. This page compares only the fuel part (gas and electricity). |
| simple payback period | The price difference of the more expensive choice divided by the savings per year. "Simple" means it assumes the same savings every year and ignores the time value of money (such as interest). It is a rough guide; how long you will keep the car and battery wear need separate thought. |
| proportional | A relationship where if one amount doubles or triples, the other also doubles or triples. Fuel cost is proportional to the miles driven, so its graph is a straight line through the origin, and the slope is the cost per mile (or per year). |
Good to know before you start
Here is what helps you use the calculation on this page with real understanding, not just by pressing the button.
If you get stuck, going back to these topics is the quickest way forward.
| Unit rates (Grade 6) |
|
| Percents (Grades 6–7) |
|
| Proportional relationships (Grades 6–7) |
|
| Positive and negative numbers (Grades 6–7) |
|
| Linear functions and where two lines cross (Grade 8) |
|
| Power and energy (middle school science) |
|
How to calculate it in Excel
| Gas price ($/gal) | 3.20 |
| Fuel economy (mpg) | 24 |
| Gas car fuel cost per mile ($/mi) | =B1/B2 |
| Electricity rate ($/kWh) | 0.18 |
| Charging loss (%) | 10 |
| Efficiency (mi/kWh) | 4 |
| EV electricity cost per mile ($/mi) | =B1/(1-B2/100)/B3 |
| Gas car fuel cost per mile ($/mi) | 0.1333 |
| EV electricity cost per mile ($/mi) | 0.05 |
| Miles per month (mi) | 1000 |
| Gas car monthly fuel cost ($) | =B1*B3 |
| EV monthly electricity cost ($) | =B2*B3 |
| Gas car yearly fuel cost ($) | =B4*12 |
| EV yearly electricity cost ($) | =B5*12 |
| Gas car yearly fuel cost ($) | 1600 |
| EV yearly electricity cost ($) | 600 |
| Yearly difference ($, gas car − EV) | =B1-B2 |
| Price difference ($, EV − gas car) | 7500 |
| Yearly difference ($, gas car − EV) | 1000 |
| Simple payback period (years) | =B1/B2 |
The first table is the example of gas at $3.20 a gallon and 24 mpg, and B3 shows about 0.1333 ($ per mile). The second table is the example of $0.18 per kWh, 10% loss and 4 mi/kWh, and B4 shows 0.05 ($ per mile). The third table multiplies those two values by 1,000 miles a month: monthly, $133.30 for the gas car and $50 for the EV; yearly, $1,599.60 for the gas car and $600 for the EV (because the gas car's cost per mile is rounded to 0.1333, this differs slightly from the calculator's $1,600).
The fourth table is the yearly difference, and B3 shows 1000 ($1,000). The fifth table divides the $7,500 price difference by it, and B3 shows 7.5 (years). If the yearly difference is negative (the gas car's fuel cost is lower) and the price difference is positive, this table's result is also negative; that means the price gap cannot be earned back through fuel costs, so do not read it as a number of years. Just replace the numbers in column B with your own.
How to calculate it in Google Sheets
| Gas price ($/gal) | 3.20 |
| Fuel economy (mpg) | 24 |
| Gas car fuel cost per mile ($/mi) | =B1/B2 |
| Electricity rate ($/kWh) | 0.18 |
| Charging loss (%) | 10 |
| Efficiency (mi/kWh) | 4 |
| EV electricity cost per mile ($/mi) | =B1/(1-B2/100)/B3 |
| Gas car fuel cost per mile ($/mi) | 0.1333 |
| EV electricity cost per mile ($/mi) | 0.05 |
| Miles per month (mi) | 1000 |
| Gas car monthly fuel cost ($) | =B1*B3 |
| EV monthly electricity cost ($) | =B2*B3 |
| Gas car yearly fuel cost ($) | =B4*12 |
| EV yearly electricity cost ($) | =B5*12 |
| Gas car yearly fuel cost ($) | 1600 |
| EV yearly electricity cost ($) | 600 |
| Yearly difference ($, gas car − EV) | =B1-B2 |
| Price difference ($, EV − gas car) | 7500 |
| Yearly difference ($, gas car − EV) | 1000 |
| Simple payback period (years) | =B1/B2 |
How to calculate it in Python
monthly_mi = 1000 # miles per month
gas_mpg = 24 # gas car fuel economy (mpg)
gas_price_per_gal = 3.20 # gas price ($ per gallon)
ev_mi_per_kwh = 4 # EV efficiency (mi/kWh)
elec_price_per_kwh = 0.18 # electricity rate ($ per kWh)
loss_percent = 10 # charging loss (%)
price_diff = 7500 # price difference ($, EV − gas car)
# cost per mile ($/mi): gas car = price ÷ mpg, EV = rate ÷ (1 − loss ÷ 100) ÷ efficiency
gas_cost_per_mile = gas_price_per_gal / gas_mpg
ev_cost_per_mile = elec_price_per_kwh / (1 - loss_percent / 100) / ev_mi_per_kwh
# yearly fuel cost ($) = cost per mile × miles per month × 12
gas_yearly = gas_cost_per_mile * monthly_mi * 12
ev_yearly = ev_cost_per_mile * monthly_mi * 12
# yearly difference ($; positive means the EV's fuel cost is lower)
yearly_diff = gas_yearly - ev_yearly
print(f"Gas car fuel cost per mile: ${gas_cost_per_mile:.4f}/mi")
print(f"EV electricity cost per mile: ${ev_cost_per_mile:.4f}/mi")
print(f"Yearly fuel cost: gas car ${gas_yearly:.2f} / EV ${ev_yearly:.2f}")
print(f"Yearly difference (gas car − EV): ${yearly_diff:.2f}")
# simple payback period: meaningful only when the more expensive car also has the lower fuel cost
if (price_diff > 0 and yearly_diff > 0) or (price_diff < 0 and yearly_diff < 0):
print(f"Simple payback period: {price_diff / yearly_diff:.1f} years")
else:
print("Simple payback period: does not apply to these inputs")
How to write it in LaTeX and other math languages (copy and paste)
c_g = p ÷ f
c_g = \frac{p}{f}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<msub><mi>c</mi><mi>g</mi></msub>
<mo>=</mo>
<mfrac><mi>p</mi><mi>f</mi></mfrac>
</mrow>
</math>
c_g = p / f
gasCostPerKm = gasPrice/fuelEconomy
c_g := p/f;
c_g = p/f;
c_g = p/f
c_e = u ÷ (1 − L ÷ 100) ÷ η
c_e = \frac{u}{\left(1 - \frac{L}{100}\right)\eta}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<msub><mi>c</mi><mi>e</mi></msub>
<mo>=</mo>
<mfrac>
<mi>u</mi>
<mrow>
<mo>(</mo><mn>1</mn><mo>−</mo><mfrac><mi>L</mi><mn>100</mn></mfrac><mo>)</mo>
<mi>η</mi>
</mrow>
</mfrac>
</mrow>
</math>
c_e = u / ((1 - L/100) * eta)
evCostPerKm = elecPrice/((1 - loss/100)*efficiency)
c_e := u/((1 - L/100)*eta);
c_e = u/((1 - L/100)*eta);
c_e = u/((1−L/100)η)
G = c_g × d × 12, E = c_e × d × 12
G = c_g \times d \times 12, \quad E = c_e \times d \times 12
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>G</mi><mo>=</mo>
<msub><mi>c</mi><mi>g</mi></msub><mo>×</mo><mi>d</mi><mo>×</mo><mn>12</mn>
<mo>,</mo><mspace width="1em"/>
<mi>E</mi><mo>=</mo>
<msub><mi>c</mi><mi>e</mi></msub><mo>×</mo><mi>d</mi><mo>×</mo><mn>12</mn>
</mrow>
</math>
G = c_g * d * 12, E = c_e * d * 12
gasYearly = gasCostPerKm*monthlyDistance*12; evYearly = evCostPerKm*monthlyDistance*12
G := c_g*d*12; E := c_e*d*12;
G = c_g*d*12; E = c_e*d*12;
G = c_g×d×12, E = c_e×d×12
Δ = G − E
\Delta = G - E
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>Δ</mi>
<mo>=</mo>
<mi>G</mi>
<mo>−</mo>
<mi>E</mi>
</mrow>
</math>
Delta = G - E
yearlyDiff = gasYearly - evYearly
Delta := G - E;
Delta = G - E;
Δ = G−E
T = ΔP ÷ Δ
T = \frac{\Delta P}{\Delta}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>T</mi>
<mo>=</mo>
<mfrac>
<mrow><mi>Δ</mi><mi>P</mi></mrow>
<mi>Δ</mi>
</mfrac>
</mrow>
</math>
T = (Delta P) / Delta
paybackYears = priceDiff/yearlyDiff
T := DeltaP/Delta;
T = DeltaP/Delta;
T = ΔP/Δ
How to have ChatGPT do the calculation
You are a calculation assistant for comparing car fuel costs. Do the following calculation by actually running Python code, and base your answer only on the numbers from the execution result (do not answer by mental math or guessing). I drive 1,000 miles a month. The gas car gets 24 mpg with gas at $3.20 per gallon. The EV gets 4 mi/kWh with electricity at $0.18 per kWh and a charging loss of 10%. The EV costs $7,500 more to buy. Find the gas car's fuel cost per mile with "gas price ÷ fuel economy", the EV's electricity cost per mile with "rate ÷ (1 − loss ÷ 100) ÷ efficiency", and the yearly fuel cost with "cost per mile × miles per month × 12". Find each of the following: 1. The cost per mile of the gas car and the EV ($ per mile) 2. The monthly and yearly fuel cost of the gas car and the EV ($) 3. The yearly difference (gas car − EV) ($) 4. The simple payback period: the price difference divided by the yearly difference (years). If the yearly difference is negative, answer that "the price gap cannot be earned back through fuel costs" Show the formulas you used and the numbers from the execution result. Do not include taxes, insurance, maintenance or tax credits.
How to Use
-
1Enter your numbersType the numbers you want to calculate with into the input fields
-
2CalculatePress the "Calculate" button
-
3Check the resultThe result appears on the spot. The same page also explains the idea behind the calculation and the formula
DataChef Features
No technical knowledge required.
Intuitive and user-friendly operation.
Can be used without registering personal information.
Automatic file deletion by clicking "download".
and rapid file conversion.
No attribution required.
No need to contact us for commercial use permission.
