Trip cost and cost per mile
Fuel cost for any drive is distance divided by fuel economy, times the price per gallon. The middle step, gallons used, is the one worth writing down, because it is what scales with the trip. Worked example with the defaults: 300 miles at 28 MPG needs 300 / 28 = 10.71 gallons. At $3.20 a gallon that is $34.29, or 11.4 cents per mile. Make it a round trip and you burn 21.43 gallons for $68.57. Over a typical 12,000-mile year the same car costs $1,371 in gasoline.
Cost per mile is the number to carry around. It equals price divided by MPG. A 20 MPG SUV at $3.20 costs 16 cents a mile; a 40 MPG hybrid costs 8 cents. On a 1,000-mile road trip the difference is $80, which is often less than people expect, and on 15,000 miles a year it is $1,200, which is often more than people expect.
Measuring MPG for real
Trip computers are optimistic by a few percent. To measure your own, fill the tank until the pump clicks off, reset the trip odometer, drive normally, then fill up again at the same pump setting and divide the miles by the gallons the pump delivered. In the second mode above, 300 miles on 11.0 gallons is 27.3 MPG. Do this over two or three tanks and average, because how full the first fill was affects a single measurement.
For conversions, US MPG and L/100 km are reciprocals scaled by a constant: L/100 km = 235.215 / MPG, and MPG = 235.215 / (L/100 km). So 28 MPG equals 8.40 L/100 km, or 11.90 km/L. Remember that one imperial gallon is 4.546 liters against 3.785 for a US gallon, so a British car rated 40 MPG is really 33 US MPG.
Comparing gasoline with charging
An electric car is rated in kilowatt-hours per 100 miles, which plays the same role as gallons per 100 miles. A typical EV uses 28 to 35 kWh per 100 miles. At 30 kWh per 100 miles, the 300-mile trip above needs 90 kWh; at a home rate of 17 cents per kWh that is $15.30, or 5.1 cents per mile, against 11.4 cents for the 28 MPG gasoline car. Over 12,000 miles the gap is about $759 a year.
Two things change that picture. Public DC fast charging often costs 35 to 55 cents per kWh, which puts an EV at 10 to 17 cents a mile, roughly gasoline parity. And EPA window stickers use MPGe, where 33.7 kWh is treated as one gallon of gasoline: 30 kWh per 100 miles is 112 MPGe. MPGe is useful for comparing EVs with each other but tells you nothing about cost unless you also know what you pay for electricity and for gas.