⛽ Gas Mileage & Fuel Cost Calculator
Calculate MPG from odometer readings and gallons used, or estimate trip fuel cost. Includes km/L and L/100km metric conversions.
Calculations use the US gallon (3.785411784 liters) and the international mile (1.609344 km), the units this site uses throughout. A UK imperial gallon is a different, larger unit — this tool does not use it.
What Gas Mileage & Fuel Cost Calculator Does
Gas mileage is just miles driven divided by gallons burned, but the part every naive version of this calculator gets wrong is where those two numbers come from. Your odometer measures total distance, not trip distance, so getting an accurate MPG means subtracting the reading at your last fill-up from the reading at this one — and using the gallons it actually took to refill the tank, not a guess at your tank size. Fill up completely both times (or use the same pump-shutoff point) so partial tanks do not distort the gallons figure.
The second common mistake is unit confusion. A US gallon (231 cubic inches, 3.785411784 liters) is not the same size as the old UK imperial gallon, and mixing them silently produces an MPG figure that is about 20% off. This calculator uses the US gallon and the international mile throughout, matching US pump prices, EPA window-sticker ratings, and every other tool on this site — it does not support or convert to the imperial gallon.
The trip-cost mode runs the same math in the other direction: given a distance and a vehicle's known MPG, it finds the gallons needed and multiplies by the price per gallon you enter. Because MPG is an average that varies with driving style, terrain, and load, treat the cost estimate as a planning figure, not an exact receipt.
Both modes also report the metric equivalents, km/L and L/100km, since fuel economy is reported that way almost everywhere outside the US. km/L rises with efficiency the same way MPG does; L/100km runs the opposite direction — a smaller number means better efficiency, which is why European and Canadian window stickers usually lead with it.
How to Use Gas Mileage & Fuel Cost Calculator
- Choose "MPG From a Trip" to calculate your fuel economy, or "Trip Fuel Cost" to estimate what a drive will cost
- For MPG: enter your odometer reading at fill-up, the reading at your next fill-up, and the gallons it took to refill
- For trip cost: enter the distance, your vehicle's known MPG, and the current price per gallon
- Review your result along with its km/L and L/100km metric equivalents
- Copy the result to save it or share it
Formula Used by Gas Mileage & Fuel Cost Calculator
Miles per gallon from a fill-up
MPG = (odometer_end − odometer_start) ÷ gallons_used
- odometer_end − odometer_start
- Miles driven between the two fill-ups
- gallons_used
- Gallons it took to refill the tank at the end of the trip
Worked example
Odometer reads 45,210 miles at fill-up, 45,560 miles at the next fill-up, and refilling took 14.2 gallons.
- Miles driven = 45,560 − 45,210 = 350 miles
- MPG = 350 ÷ 14.2 = 24.6479...
Result: 24.65 MPG.
MPG to metric fuel economy
km/L = MPG × (1.609344 ÷ 3.785411784) | L/100km = (100 × 3.785411784 ÷ 1.609344) ÷ MPG
- 1.609344
- Exact kilometers per mile (international yard-and-pound agreement, 1959)
- 3.785411784
- Exact liters per US gallon (231 cubic inches)
Worked example
The 24.6479 MPG result from the fill-up above.
- km/L = 24.6479 × (1.609344 ÷ 3.785411784) = 24.6479 × 0.425144 = 10.4789
- L/100km = 235.2146 ÷ 24.6479 = 9.5430
Result: 10.48 km/L, or 9.54 L/100km.
Trip fuel cost
gallons_needed = distance ÷ MPG | total_cost = gallons_needed × price_per_gallon
- distance
- Trip distance in miles
- MPG
- Vehicle's known average fuel economy
- price_per_gallon
- Current price at the pump, in dollars
Worked example
A 342-mile trip in a vehicle averaging 28 MPG, with gas at $3.29/gallon.
- gallons_needed = 342 ÷ 28 = 12.2143
- total_cost = 12.2143 × 3.29 = 40.1847
Result: 12.21 gallons, costing $40.18.
Limitations & Accuracy Notes
- MPG calculated from a single fill-up reflects that specific tank of driving — city vs. highway mix, weather, cargo load, and even how full "full" was at each pump can shift the number by several MPG. Averaging several fill-ups gives a more reliable figure than any one of them.
- The trip-cost estimate assumes constant fuel economy for the whole trip and a single, unchanging price per gallon. Long trips that cross regions with different gas prices, or that include a lot of stop-and-go driving, will cost more or less than this estimate.
- This tool uses the US gallon only. If you have a figure in UK imperial gallons, convert it to US gallons or liters before entering it here — mixing gallon definitions will silently produce a wrong MPG.
Frequently Asked Questions
How do I calculate my car's gas mileage?
How do I convert MPG to km per liter or L per 100km?
Does this calculator use the US or UK gallon?
References & Further Reading
- FuelEconomy.gov — Gas Mileage Tips (official U.S. DOE/EPA fuel economy site) — Confirmed live 2026-09-19: run jointly by the U.S. Department of Energy and EPA, covers driving habits, maintenance, and trip planning for fuel economy.