CalcOpenly
English

Gas mileage calculator (MPG calculator)

Gas mileage calculator: MPG (US and UK), L/100 km and km/L from odometer readings and fuel added, cost per mile, and a fill-up log with trend chart.

Drafted with AI writing toolsUpdated Checked examples: 6

$
Per unit chosen under “Fuel in”. The default is the EIA US average for regular gasoline, $4.478 a gallon in the week of 21 September 2026.
More options
Try
Fuel economy (US)
mpg
Fuel economy (US): 31.8 mpg
Decimal places: 1; Nearest, ties to even
Fuel economy (UK)
38.2mpg
Fuel consumption
7.39L/100 km
Kilometers per liter
13.54km/L
Distance
312mi / 502.1km
Fuel used
9.8US gal / 37.1L
Fuel cost
$43.90
Cost per mile
$0.141
Cost per km
$0.087
CO₂ from the fuel
87.1kg

312 mi on 9.8 gal is 31.8 mpg, the same as 38.2 UK mpg, 7.39 L/100 km, or 13.54 km/L. The fuel cost $43.90, $0.141 per mile.

Fuel cost per 100 mi at $4.48 per gallon

$0$10$20$30$40102030405060mpgCost per 100 mi31.8 mpg
How it's calculated S
  1. Distance since the last fill-up

    24,812−24,500=312 mi24{,}812 - 24{,}500 = 312\ \text{mi}
  2. Distance per unit of fuel

    312 mi9.8 gal=31.8367 mi/gal\frac{312\ \text{mi}}{9.8\ \text{gal}} = 31.8367\ \text{mi/gal}
  3. Convert to the other units

    US mpg=312.00 mi9.8 gal=31.84,L/100 km=100×37.097502.12=7.39\text{US mpg} = \frac{312.00\ \text{mi}}{9.8\ \text{gal}} = 31.84,\quad \text{L/100 km} = \frac{100 \times 37.097}{502.12} = 7.39

    1 mi = 1.609344 km, 1 US gal = 3.785411784 L, 1 UK gal = 4.54609 L (exact, NIST SP 811).

  4. Fuel cost

    9.8×4.48=43.90;43.90312 mi=0.1407 per mi9.8 \times 4.48 = 43.90;\quad \frac{43.90}{312\ \text{mi}} = 0.1407\ \text{per mi}
  5. CO₂ from the fuel

    9.8 gal×8,887 g/gal÷1000=87.1 kg9.8\ \text{gal} \times 8{,}887\ \text{g/gal} \div 1000 = 87.1\ \text{kg}

    EPA emission factor for gasoline.

About the gas mileage calculator

Fuel economy is the distance driven divided by the fuel it took to refill the tank. Enter the odometer reading at your last fill-up and today's, or the trip distance, and the gallons or liters you just added. The result is shown as US mpg, UK mpg, L/100 km and km/L, with the fuel cost per mile and per kilometer and the CO₂ the fuel released.

With the defaults, 312 miles on 9.8 gallons is 31.8 mpg. At $4.48 a gallon, the US average for regular in the week of 21 September 2026 (EIA), that tank cost $43.90, or 14.1 cents a mile. The fill-up log takes one line per fill-up and gives the average over all of them, each tank's figure and a trend line.

The method assumes you fill to the same level each time, since a partly filled tank makes one reading high and the next one low. The average of a log is total miles over total fuel, which is not the same as averaging the per-tank mpg.

How to calculate gas mileage (MPG)

Divide the miles driven since your last fill-up by the gallons it takes to fill the tank again. Driving from 24,500 to 24,812 miles is 312 miles, and refilling with 9.8 gallons gives 312 ÷ 9.8 = 31.8 mpg. The method works when you fill the tank completely both times.

The full-tank method, step by step

  1. Fill the tank until the pump shuts off and note the odometer reading.
  2. Drive as usual. The longer the distance, the less a slightly different fill level matters.
  3. Fill up again and note the gallons added and the new odometer reading.
  4. Subtract the two readings and divide by the gallons added.

The US Department of Energy's fueleconomy.gov uses the same method: 33,001.3 − 32,645.1 = 356.2 miles on 13.5 gallons is 26.4 mpg.

MPG to L/100 km and UK mpg

  • L/100 km = 235.215 ÷ US mpg, or 282.481 ÷ UK mpg.
  • UK mpg = US mpg × 1.20095, because a UK gallon is 4.54609 L and a US gallon 3.785411784 L.
  • km/L = US mpg × 0.425144, from 1 mile = 1.609344 km.

The tank above is 31.8 US mpg, 38.2 UK mpg, 7.39 L/100 km and 13.54 km/L. Higher mpg and km/L are better; lower L/100 km is better. The unit factors are exact (NIST SP 811).

Average several fill-ups with totals

Overall mpg is total miles ÷ total gallons. Averaging the per-tank figures gives every tank equal weight, which can push the answer either way:

  • 100 miles on 5 gallons (20 mpg) and 100 miles on 10 gallons (10 mpg): the plain average is 15, but 200 ÷ 15 = 13.3 mpg.
  • 100 miles on 10 gallons (10 mpg) and 400 miles on 20 gallons (20 mpg): the plain average is again 15, but 500 ÷ 30 = 16.7 mpg.

The same applies to L/100 km: use 100 × total liters ÷ total km.

Totals also absorb uneven fills. Take three tanks of 312 miles on 9.8 gallons, 293 on 9.4 and 316 on 10.1. If the second fill-up stops at 4.0 gallons, that tank reads 73.3 mpg.

The third fill-up then takes the missing fuel, 15.5 gallons, and reads 20.4 mpg. Over all three tanks, 921 miles on 29.3 gallons is still 31.4 mpg, the same as with full fills.

Fuel cost per mile and CO₂

At 4.48 a gallon, the 9.8-gallon refill costs 43.90. Spread over 312 miles that is 14.1 cents a mile, the same as 4.48 ÷ 31.8 mpg. This covers fuel only; insurance, repairs and depreciation are separate.

Burning a gallon of gasoline releases about 8,887 grams of CO₂, and a gallon of diesel about 10,180 grams (EPA). The 9.8 gallons above produce 87.1 kg, about 279 grams a mile, counting tailpipe CO₂ only.

Example tanks

ScenarioUS mpgL/100 kmFuel cost
Default31.8367357.38815043.904000
Metric tank29.4018238.00000072.000000
UK gallons36.4294966.45670748.000000
Default log31.6803287.424626203.280000
Unweighted understates16.66666714.112875134.400000
  • Default: 312 miles on 9.8 US gallons at 4.48 a gallon.
  • Metric tank: 500 km on 40 liters at 1.80 a liter.
  • UK gallons: 350 miles on 8 UK gallons at 6.00 a UK gallon, which is 43.75 UK mpg.
  • Default log: five fill-ups totaling 1,546 miles on 48.8 gallons, each with its own price.
  • Unweighted understates: the 10 mpg and 20 mpg tanks above, at 4.48 a gallon.

Entering fill-ups

  • The fuel unit also sets the price unit: per liter for liters, per UK gallon for UK gallons.
  • If the odometer rolled over or was replaced, enter the trip distance instead of two readings.
  • In a fill-up log, the first line is the starting odometer and each later line is odometer, fuel added, price, oldest first, such as 24812, 9.8, 3.89. The price is optional.
  • The first line's fuel is not counted, since it filled the tank before the measured driving began.

Mistakes that distort MPG

  • Skipping a fill-up in the log. The next line then pairs two tanks' distance with one tank's fuel, so that tank reads about double.
  • Mixing US and UK gallons. The same tank is 31.8 US mpg and 38.2 UK mpg.
  • Changing tire size. A taller tire makes the odometer under-record distance, so mpg reads low; the tire size calculator gives the correction.

To estimate fuel for a trip you have not driven yet, use the fuel cost calculator. For insurance, repairs and depreciation as well, use the car ownership cost calculator.

Worked examples

312 miles on 9.8 US gallons at $4.48

Calculate from
One fill-up
Distance in
Miles
Fuel in
US gallons
Distance from
Odometer readings
Odometer at last fill-up
24,500
Odometer now
24,812
Fuel added to refill the tank
9.8
Fuel price per gallon or liter
4.48
Fuel economy (US)
31.8 mpg
Fuel economy (UK)
38.2 mpg
Fuel consumption
7.39 L/100 km
Kilometers per liter
13.54 km/L
Fuel cost
43.90
Cost per mile
0.141
CO₂ from the fuel
87.1 kg

Checked against: 312/9.8 = 31.8367 mpg; ×4.54609/3.785411784 = 38.2343 UK mpg; 100×9.8×3.785411784/(312×1.609344) = 7.3882 L/100 km; 9.8×8.887 kg = 87.09 kg (EPA factor)

fueleconomy.gov worked example

Calculate from
One fill-up
Distance in
Miles
Fuel in
US gallons
Distance from
Odometer readings
Odometer at last fill-up
32,645.1
Odometer now
33,001.3
Fuel added to refill the tank
13.5
Fuel price per gallon or liter
4.48
Fuel economy (US)
26.4 mpg
Distance
356.2 mi

Checked against: fueleconomy.gov, Calculate your own gas mileage: 33,001.3 − 32,645.1 = 356.2 miles; 356.2 ÷ 13.5 = 26.4 mpg

Trip of 520 km on 38.4 liters

Calculate from
One fill-up
Distance in
Kilometers
Fuel in
Liters
Distance from
Trip distance
Distance driven
520
Fuel added to refill the tank
38.4
Fuel price per gallon or liter
1.85
Fuel consumption
7.38 L/100 km
Kilometers per liter
13.54 km/L
Fuel economy (US)
31.9 mpg
Fuel cost
71.04
Cost per km
0.137

Checked against: 38.4×100/520 = 7.3846; 520/38.4 = 13.5417; 235.2145833/7.384615 = 31.8520 US mpg; 38.4×1.85 = 71.04

UK: 410 miles on 42 liters

Calculate from
One fill-up
Distance in
Miles
Fuel in
Liters
Distance from
Trip distance
Distance driven
410
Fuel added to refill the tank
42
Fuel price per gallon or liter
1.40
Fuel economy (UK)
44.4 mpg
Fuel economy (US)
37.0 mpg
Fuel consumption
6.37 L/100 km

Checked against: 410/(42/4.54609) = 44.3785 UK mpg; 410/(42/3.785411784) = 36.9528 US mpg; 4200/(410×1.609344) = 6.3653

Questions

How do you calculate gas mileage?

Fill the tank and note the odometer. At the next fill-up, subtract the old reading from the new one and divide by the gallons it took to fill the tank again. Driving 312 miles and adding 9.8 gallons gives 312 ÷ 9.8 = 31.8 mpg. The US Department of Energy's fueleconomy.gov uses the same full-tank method in its worked example: 356.2 miles on 13.5 gallons is 26.4 mpg.

How do you convert mpg to L/100 km?

Divide 235.215 by US mpg, or 282.481 by UK mpg. The constants come from 100 × 3.785411784 L ÷ 1.609344 km for the US gallon and 100 × 4.54609 ÷ 1.609344 for the imperial gallon. So 31.8 US mpg is 7.4 L/100 km, and 7.4 L/100 km is 38.2 UK mpg. Because the relationship is a division, halving L/100 km doubles mpg.

Why should I average mpg over several fill-ups?

Pumps shut off at slightly different levels, so fuel left out of one fill-up is added at the next, making one tank read high and the next low. fueleconomy.gov warns that an estimate is not accurate unless the tank is filled completely. Dividing the total miles of all fill-ups by their total gallons cancels most of that error. Averaging the per-tank mpg figures gives every fill-up equal weight and can overstate or understate the combined economy. Total miles divided by total gallons is a fuel-weighted average of the per-tank mpg figures.

How much CO₂ does a gallon of gas produce?

Burning one gallon of gasoline produces about 8,887 grams of CO₂, and a gallon of diesel about 10,180 grams, according to the US Environmental Protection Agency. A car averaging 31.8 mpg therefore emits about 280 grams of CO₂ per mile from its tailpipe. EPA's typical passenger vehicle, at 22.2 mpg and 11,500 miles a year, emits about 4.6 metric tons a year. The figure scales with fuel burned, so each mpg gained lowers emissions in proportion.

What is the cost per mile of driving?

Fuel cost per mile is the price per gallon divided by mpg: $4.48 ÷ 31.8 mpg is 14.1 cents a mile. That covers fuel only. The IRS business standard mileage rate, 76 cents a mile from 1 July 2026 (IR-2026-29), also covers depreciation, insurance, repairs and tires, so it is more than five times the fuel cost of this car.

About this calculator

mpg=odometernow−odometerlast fillgallons added,L/100 km=235.215mpg (US)\text{mpg} = \frac{\text{odometer}_{\text{now}} - \text{odometer}_{\text{last fill}}}{\text{gallons added}},\qquad \text{L/100 km} = \frac{235.215}{\text{mpg (US)}}

Sources

  1. US DOE / EPA fueleconomy.gov — Calculate your own gas mileage (My MPG)
  2. NIST SP 811 Appendix B.9 — gallon (US and imperial) and mile conversion factors
  3. EIA — Weekly US regular gasoline prices (historical example, 21 September 2026)
  4. IRS — Standard mileage rates (76 cents per business mile from 1 July 2026)
  5. US EPA — Greenhouse gas emissions from a typical passenger vehicle (8,887 g CO₂ per gallon of gasoline)

Checked against references

This calculator includes 6 worked examples with independently sourced answers. They run in the test suite, and you can run them here too.

Put this calculator on your site

Paste this where you want the calculator to appear. It is free to use, it stays in step with corrections made here, and the credit line below it links back so your readers can find the full version.

Height
Preview the embed

Keep the credit line. It is the only condition, and it is what keeps these calculators free.