How the gas mileage calculator works
Gas mileage is distance divided by fuel: how many miles the car covers on each gallon. The only reliable way to know it is to measure both, and that is what the first two tabs do. The MPG tab is a plain mpg calculator for when you already know the miles and the gallons, for example from the trip odometer and the pump display. The Fill-up to fill-up tab takes two odometer readings instead, the way fueleconomy.gov recommends measuring it.
Each result comes in every common unit at once: miles per gallon, L/100 km, kilometers per liter and the gallons the car burns every hundred miles. That makes it a fuel economy calculator for comparing your figure with a European spec sheet or a forum post in metric units without hunting for a converter.
The Trip fuel cost tab works forward: distance and fuel economy give the fuel a trip will take, and the fuel price you type in turns that into a cost. The calculator has no prices of its own and assumes no currency.
What to enter and where to find it
- Distance driven. From the trip odometer, reset when the tank was last filled to the top, or the difference between two odometer readings.
- Fuel used. The gallons the pump shows when you fill the tank back up, not the size of the tank. Pumps show it to three decimals; two are plenty.
- Odometer readings. The main odometer at the last full fill-up and now. Mixing up the main and trip odometers is the most common slip, especially in an unfamiliar car.
- Your fuel economy and the fuel price. For a trip, use mpg you measured, typed in L/100 km if you switch to metric units. The price is per gallon, or per liter in metric, and stays optional.
The fill-up to fill-up method
The method fueleconomy.gov describes needs nothing but a pen. Fill the tank until the pump clicks off and write down the odometer. Drive as you normally would. At the next fill-up, fill it to the top again and write down the gallons it took and the new odometer reading. The miles between the two readings divided by the gallons of the second fill-up is the mpg of that tank. Resetting the trip odometer at every fill-up does the subtraction for you.
It only works if both fill-ups are complete. A partial fill on either end means the gallons no longer match the miles, and the result can be off in either direction. Filling at the same pump, letting it click off once and not topping up keeps the two fills comparable.
One tank is a snapshot. Weather, traffic, a long idle or a dragstrip day all move it, so log several tanks and work out the average from the totals: add up all the miles and all the gallons, then divide.
MPG, L/100 km and km/L
Miles per gallon and kilometers per liter measure economy: distance per unit of fuel, where higher is better. L/100 km and gallons per hundred miles measure consumption: fuel per unit of distance, where lower is better. Each pair is the other turned upside down, which is why an mpg figure does not scale linearly into L/100 km.
The difference matters when you compare cars or upgrades. The EPA’s own example: over 1,000 miles, going from 10 to 15 mpg saves about 33 gallons, while going from 30 to 35 mpg, the same gain on paper, saves only about 5. This is why the EPA fuel economy label also shows consumption, and why the drawing in the result shows the L/100 km marks bunching up at the high end of the mpg scale.
Trip fuel cost at your price
For a trip fuel cost, the calculator divides the distance by your fuel economy to get the fuel, then multiplies by the price you enter. The price can be in any currency: the result comes out in the same one, and a price per liter works the same way once the unit switch is set to metric. Leave the price empty and you still get the fuel.
Use mpg you have measured on similar driving. A highway trip usually returns better mileage than a week of short hops, and a car loaded for a track weekend usually returns less, so a fill-up figure from comparable driving beats any label.
The gas mileage formula
None of the formulas is an estimate: they are definitions and exact unit conversions, so the result is as good as the miles and gallons you enter. For a trip, the answer is only as good as the mpg you assume.
mpg = miles driven ÷ gallons usedMiles driven = odometer now − odometer at the last fill-upL/100 km = 235.215 ÷ mpgkm/L = mpg × 1.609344 ÷ 3.785411784Trip fuel = trip miles ÷ mpg; trip cost = trip fuel × your price per gallon
The 235.215 is not a rounded rule of thumb. It is a hundred times the liters in a US gallon, 3.785411784, divided by the kilometers in a mile, 1.609344, and because L/100 km is consumption it divides into mpg instead of multiplying it. Gallons per hundred miles is simply the trip fuel formula for a hundred-mile trip.
Worked example
Two everyday questions, worked out with the same functions that run the calculator.
One tank, fill-up to fill-up
A driver fills a turbocharged four-cylinder hatchback to the top with the odometer at 21,450.0 miles. A week later the odometer reads 21,782.5 and the tank takes 12.5 gallons to fill again:
- Miles on this tank 21,782.5 − 21,450.0 = 332.5 mi
- Miles per gallon 332.5 mi ÷ 12.50 gal = 26.60 mpg
- Liters per 100 km 100 × 3.785412 L/gal ÷ 1.609344 km/mi = 235.215; 235.215 ÷ 26.60 = 8.84 L/100 km
- Kilometers per liter 26.60 × 1.609344 ÷ 3.785412 = 11.31 km/L
- Gallons per hundred miles 100 ÷ 26.60 = 3.76 gal
That tank returned 26.6 mpg, which is 8.8 L/100 km or 11.3 km/L, and the hatchback burned 3.76 gallons for every hundred miles.
Fuel for a trip
The same driver plans a 420-mile round trip to a dragstrip and uses the 26.6 mpg from that tank rather than the window sticker:
- Fuel needed 420 mi ÷ 26.6 mpg = 15.79 gal
- Fuel cost 15.79 gal × the price you pay per gallon
- Same trip in L/100 km 235.215 ÷ 26.6 = 8.84 L/100 km
The trip takes about 15.8 gallons. Multiply that by what you pay per gallon for the cost; type the price into the calculator and it does the multiplication, in whatever currency you pay in.
MPG to L/100 km conversion table
The table converts common mpg figures into the other units and shows the fuel each takes over 1,000 miles. Read down the last column to see the effect described above: each five-mpg step saves a lot of fuel near the top of the table, where mpg is low, and very little near the bottom.
| mpg (US) | L/100 km | km/L | Gallons per hundred miles | Gallons for 1,000 miles |
|---|---|---|---|---|
| 10 | 23.5 | 4.3 | 10.00 | 100.0 |
| 15 | 15.7 | 6.4 | 6.67 | 66.7 |
| 20 | 11.8 | 8.5 | 5.00 | 50.0 |
| 25 | 9.4 | 10.6 | 4.00 | 40.0 |
| 30 | 7.8 | 12.8 | 3.33 | 33.3 |
| 35 | 6.7 | 14.9 | 2.86 | 28.6 |
| 40 | 5.9 | 17.0 | 2.50 | 25.0 |
| 50 | 4.7 | 21.3 | 2.00 | 20.0 |
Common mistakes
- Not filling up completely both times. A partial fill at either end breaks the fill-up to fill-up method, as fueleconomy.gov points out. If one fill-up was partial, keep counting: add its gallons to those of the next full fill-up and divide the miles since the last full tank by the total.
- Averaging mpg figures. The average of two tanks’ mpg is not the mpg of both. Add the miles, add the gallons and divide the totals.
- Comparing with the window sticker. EPA label figures come from standardized laboratory tests. Your mileage differs with driving habits, maintenance, weather and road conditions.
- Mixing US and UK gallons. A UK mpg figure uses the imperial gallon of 4.546 liters, about 20% larger than the US gallon, so it reads higher for the same car. Convert it before comparing.
- Forgetting a tire size change. The odometer counts tire turns, so a different overall diameter skews the miles, and the mpg with them. The tire size calculator shows the difference between two sizes.
Last updated October 29, 2026 by Fernando Margareto, Founder & Editor.