How do you calculate mpg?

Short answer. Divide the miles you drove by the gallons you used. Fill the tank, reset the trip meter, drive, then fill to full again and divide the miles by the gallons that second fill took: 312 miles on 11.6 gallons is 26.9 mpg. Over several tanks, divide total miles by total gallons. Never average mpg figures.

Miles per gallon is a division with the answer written in its name:

mpg  =  miles driven ÷ gallons used

The miles are easy, the car counts them. The hard part is the gallons. A fuel gauge is a vague needle, so the only honest measurement of fuel burned is the pump, and the pump only tells you something useful when it fills the tank to the same level twice.

The full tank method

Fill up until the pump clicks off. Ignore how much went in; that fill just sets the starting line. Zero the trip meter, or write down the odometer. Drive normally. When you next need fuel, fill until the pump clicks off again. The gallons on that receipt are exactly what the car burned since the last click.

Odometer at first fill     41,236
Odometer at second fill    41,548
Miles driven               41,548 − 41,236  =  312
Gallons (second receipt)   11.6

mpg                        312 ÷ 11.6  =  26.8966…   →  26.9 mpg

Same pump, same click, same level both times. If you top off past the click on one fill and not the other, the measurement inherits the difference, so be boring about it.

Averaging several tanks: the trap

One tank is a sample. Highway one week, school runs the next. To get a real figure, collect a few tanks, and here is where people go wrong:

Tank 1     300 miles ÷ 10 gallons   =  30 mpg
Tank 2     100 miles ÷  5 gallons   =  20 mpg

Wrong      (30 + 20) ÷ 2            =  25 mpg
Right      400 miles ÷ 15 gallons   =  26.666…  →  26.67 mpg

Averaging the two mpg figures treats a 100 mile tank as if it counted as much as a 300 mile tank. It does not. Add the miles, add the gallons, divide once. This is a weighted average wearing a car costume, and the same mistake as averaging percentages without their totals.

The trick also rescues partial fills. If you buy fuel three times between two full tanks, add all three receipts together. Only the first and last fills need to reach the click.

mpg to L/100km, and why it flips

Most of the world measures the other way round: liters burned per 100 kilometers. Lower is better, which is the first thing that confuses everyone. Both units are exact, a mile is 1.609344 km and a US gallon is 3.785411784 liters, so the conversion constant is exact too:

100 × 3.785411784 ÷ 1.609344   =  235.2145833…

L/100km  =  235.215 ÷ mpg
mpg      =  235.215 ÷ L/100km

The same division goes both ways because the two units are reciprocals of each other, scaled. 30 mpg is 235.215 ÷ 30 = 7.84 L/100km, and 8 L/100km is 235.215 ÷ 8 = 29.40 mpg.

US mpgL/100kmUK mpg
1515.6818.0
2011.7624.0
259.4130.0
307.8436.0
356.7242.0
405.8848.0
504.7060.0

Why going from 10 to 20 mpg beats going from 25 to 50

Because mpg is miles over gallons, equal steps in mpg are not equal steps in fuel. Count the gallons for the same 1,000 miles instead:

10 mpg  →  1,000 ÷ 10  =  100 gallons
20 mpg  →  1,000 ÷ 20  =   50 gallons     saves 50 gallons

25 mpg  →  1,000 ÷ 25  =   40 gallons
50 mpg  →  1,000 ÷ 50  =   20 gallons     saves 20 gallons

Doubling a thirsty car's mpg saves more than doubling a frugal car's, even though 25 to 50 looks like the bigger jump. Liters per 100 km does not have this problem, since it already counts fuel. In US terms, gallons per 100 miles is just 100 ÷ mpg: 10 mpg is 10 gallons, 25 mpg is 4, 50 mpg is 2.

US gallons versus UK gallons

A UK gallon is exactly 4.54609 liters, about 20% larger than the US one. More fuel per gallon means more miles per gallon from the same car on the same drive:

UK mpg  =  US mpg × 4.54609 ÷ 3.785411784  =  US mpg × 1.20095

30 US mpg   →  36.0 UK mpg
50 UK mpg   →  50 ÷ 1.20095  =  41.6 US mpg

So a British review quoting 50 mpg and an American one quoting 42 mpg can be describing the same engine. For L/100km from UK mpg, the constant becomes 282.481 instead of 235.215.

From mpg to cost per mile

Once you have mpg, cost per mile is your price per gallon divided by it. With an example price of $4.00 a gallon (use whatever your receipt says):

Cost of the tank     11.6 × $4.00     =  $46.40
Cost per mile        $4.00 ÷ 26.8966  =  $0.1487  →  14.9¢ a mile
Check                $46.40 ÷ 312     =  $0.1487

That is the number to use when you split the cost of a road trip by distance rather than by heads.

Where the decimals go wrong

312 ÷ 11.6 looks harmless. As a fraction it is 3120/116, which reduces to 780/29, and a denominator of 29 gives a repeating decimal with a 28 digit cycle: 26.8965517241379310344827586206 and around again. Any calculator has to stop somewhere, so round once, at the end, to 26.9.

Adding up receipts has a subtler problem. Two fills of 10.1 and 10.2 gallons are 20.3 gallons. A machine doing binary floating point gets 20.299999999999997, the same fault behind 0.1 + 0.2 = 0.30000000000000004, because neither 10.1 nor 10.2 has an exact binary form. Prism works in exact decimals, so the receipts add to 20.3, 0.1 + 0.2 is 0.3, and the mpg is computed from the real totals.

Prism Calculator icon

Divide it, then convert it

The miles over gallons division works in Prism's free calculator, with history to keep each tank's figures. The fuel economy category of the unit converter (US mpg, UK mpg, km/L and L/100km) is part of the one-time $3.99 unlock. No ads, no subscription. See the app.