Skip to the calculator
Rule Calculator

Gas Mileage Calculator

With miles driven 342 mi, gallons to refill 12.4 gal, price per gallon 3.45 usd, gas mileage comes to 27.6 mpg — miles per gallon. It is reached in 4 steps, the last of which is miles / gallons, and each one is printed on the page with its numbers filled in. The formula is the one published by US Department of Energy, not an approximation fitted to it.

Miles per gallon from a tank of fuel and the miles it covered, with the litres-per-100-km figure and the cost per mile it works out to.

By Alex Seote, Built and maintains Rule Calculator · Formula and sources checked · How we check

Miles driven 342 mi, Gallons to refill 12.4 gal, Price per gallon 3.45

27.6 mpg

Miles per gallon for the example below. Editing a field recomputes the calculator below; this figure holds the answer the page was loaded with.

It is written into the HTML rather than drawn by a script, so a search engine reading this page without running JavaScript still finds an answer.

Miles per gallon
27.6 mpg
Miles per gallon
miles / gallons27.581 mpg
Litres per 100 km
235.214583 / mpg8.528
Cost per mile
price / mpg0.125
Cost per 100 miles
cost_per_mile * 10012.509

Ask about this in the chat

Worked example

342 miles on 12.4 gallons is 27.6 mpg, or 8.5 litres per 100 km, and 12.5 cents a mile at $3.45. One tank is a noisy sample: a headwind, a roof box or a week of short trips moves it by several mpg, so average three fills before believing a change.

How to work it out yourself

  1. 1.Fill the tank and reset the trip meter, or write down the odometer.
  2. 2.Drive normally until the next fill, then fill to the same point — the pump clicking off is repeatable, topping up by hand is not.
  3. 3.Divide the miles by the gallons it took. Litres per 100 km is 235.215 divided by the mpg figure, and it runs the other way: a lower number is better.

The formula

  1. Miles per gallonmiles / gallons
  2. Litres per 100 km235.214583 / mpg
  3. Cost per mileprice / mpg
  4. Cost per 100 milescost_per_mile * 100

Source: US Department of Energy — fueleconomy.gov

Questions people actually ask

Why does the trip computer disagree with this?
Trip computers estimate fuel use from injector timing rather than measuring it, and most read optimistic by a few per cent. The brim-to-brim method measures the fuel that actually went in, which is why it is the one worth trusting when the two differ.
Why is mpg not the reciprocal of litres per 100 km?
Because they are inverses of each other rather than scalings: mpg is distance over fuel, l/100 km is fuel over distance. The conversion is 235.215 divided by the figure, in either direction. It also means equal mpg gains are not equal fuel savings — going from 15 to 20 mpg saves far more fuel than going from 40 to 45.
How many tanks before the number means anything?
Three or more. A single tank carries the weather, the traffic and how full the last fill really was; the spread between consecutive tanks on the same car is routinely 10%.

Related

Put this calculator on your site

Free, no attribution required beyond the link.

<iframe src="https://rulecalculators.com/embed/gas-mileage" width="100%" height="420" style="border:1px solid #e7e4de;border-radius:12px" title="Gas Mileage Calculator"></iframe>
Did this answer your question?