ThisCalculator

Sports and fitness

Gas Mileage Calculator: MPG & Cost

Updated · Standard formula, shown below

Fuel economy 25.0 MPG
Cost per mile
0.14 $/mi
Result
Trip fuel cost
42.00 $
Result
Distance
300 mi
You entered

Gas Mileage Calculator: MPG & Cost

This gas mileage calculator works out your fuel economy in miles per gallon (MPG) or liters per 100 km, plus the cost per mile and per trip. You enter the distance driven and the fuel used (or the price per gallon and total spent), and it returns your average consumption and trip cost. It is the same math your car’s trip computer does, but with your own numbers and no guesswork.

Formula

The core formula is simple:

MPG = Distance ÷ Fuel used

Where:

  • Distance is the miles traveled (or kilometers for L/100 km).
  • Fuel used is the gallons consumed (or liters).
  • MPG is miles per gallon — the higher, the better.

For metric users, the common measure is L/100 km = (Fuel used in liters ÷ Distance in km) × 100. Lower is better here.

Worked Example

Using the defaults from the calculator: you drive 300 miles and use 12 gallons of fuel at $3.50 per gallon.

  1. MPG: 300 ÷ 12 = 25.0 MPG
  2. Cost per mile: $3.50 ÷ 25.0 = $0.14 per mile
  3. Total trip cost: 12 × $3.50 = $42.00

That matches the calculator output exactly.

How to Measure Your Own MPG Accurately

The most reliable method is the “full tank to full tank� approach:

  1. Fill the tank completely and reset the trip odometer to zero.
  2. Drive normally until you need fuel again — the more miles, the better.
  3. Fill the tank completely again. Note the gallons shown on the pump.
  4. Divide the trip odometer miles by the gallons from the second fill-up.

For example, if you drove 340 miles and pumped 11.5 gallons, your MPG is 340 ÷ 11.5 = 29.6 MPG. Avoid topping off after the pump clicks; it distorts the measurement.

Common Mistakes and Misconceptions

  • Mixing units: If you measure distance in kilometers and fuel in gallons, the result is nonsense. Convert everything to the same system first.
  • Using the car’s trip computer as gospel: Built-in estimates are often 5–10% optimistic. Manual calculation is more accurate.
  • Short trips: A 5-mile test includes cold-engine inefficiency. Use at least a few hundred miles for a stable average.
  • Confusing MPG with L/100 km: A higher MPG is good, but a higher L/100 km is bad. The two scales are inversely related.

Why MPG Matters Beyond the Pump

Knowing your real-world fuel economy helps you:

  • Budget trips: A 500-mile trip at 25 MPG and $3.50/gal costs $70; at 30 MPG it costs $58.33 — a real difference.
  • Spot vehicle problems: A sudden 15% drop in MPG often signals under-inflated tires, a dirty air filter, or a failing oxygen sensor.
  • Compare vehicles honestly: The EPA window sticker is a lab test; your driving style, terrain, and weather change the real number.

How to Improve Your Gas Mileage

Simple habits typically improve economy by 5–15%:

  • Keep tires inflated to the pressure on the door sticker.
  • Remove roof racks and heavy cargo when not needed.
  • Avoid aggressive acceleration and hard braking.
  • Use cruise control on highways.
  • Combine short errands into one trip to avoid cold starts.

Note that idling burns fuel at roughly 0.2–0.5 gallons per hour depending on engine size — turning off the engine during long waits helps.

Limitations of the Calculator

This calculator assumes a constant fuel price and a single trip. Real-world driving includes stop-and-go traffic, elevation changes, and weather, which this simple model cannot capture. For a more precise estimate over time, track multiple fill-ups and average the results. Also, the calculator does not account for electric or hybrid vehicles where fuel is only part of the energy input.

Frequently Asked Questions

What is a good MPG?

For a typical gasoline car, 25–30 MPG is average; 35+ MPG is good; 40+ MPG is excellent. Trucks and SUVs often get 15–20 MPG. Compare your number to the EPA rating for your specific vehicle model.

How do I convert MPG to L/100 km?

Divide 235.21 by the MPG value. For example, 30 MPG = 235.21 ÷ 30 = 7.84 L/100 km. Conversely, divide 235.21 by the L/100 km value to get MPG.

Why does my car’s trip computer show higher MPG than my manual calculation?

Manufacturers often calibrate the display optimistically, and the computer may not account for fuel used during idling or when the engine is off. Manual calculation from actual pump readings is the most trustworthy.

Does driving speed affect MPG?

Yes. Most cars achieve peak efficiency around 50–60 mph. Above 60 mph, aerodynamic drag increases sharply, and MPG typically drops by about 1–2 mpg for every 5 mph over 60.

Can I use this calculator for a one-way trip?

Yes, but for a round trip, enter the total distance and total fuel used. For a single leg, you need to know how much fuel that leg consumed, which is hard to measure without a full tank before and after.

What if I use diesel or E85?

The math is identical — just enter the fuel amount and price for that fuel. However, diesel and E85 have different energy densities, so MPG will differ from gasoline even in the same vehicle.

Related

Formula used
in d | Distance | mi | 300 | 0
in f | Fuel used | gal | 12 | 0
in p | Fuel price | $/gal | 3.50 | 0
out mpg | Fuel economy | MPG | d / f | 1
out cpm | Cost per mile | $/mi | p / (d / f) | 2
out trip | Trip fuel cost | $ | f * p | 2

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.