MPG = miles ÷ gallonsReviewed 29 Sep 2026Runs in your browser

Gas Mileage (MPG) & Trip Fuel Cost Calculator

Work out your real fuel economy from a fill-up, or plan the fuel cost of a trip. See gallons and litres used, cost per mile, the split between passengers, the CO₂ produced, and what the same trip would cost in an electric vehicle.

Who wrote it

Written by Suhaib Hassan. Emission factors come from the US EPA. Our methodology.

How the engine works

It divides distance by fuel economy for gallons, multiplies by price, then converts to litres, CO₂ and an EV equivalent.

Why we built it

Your real MPG differs from the sticker. This measures it from your own fill-ups and prices trips from it.

Trip parameters

miles
US MPG
Vehicle presets
$
doubles the distance
1 person
optional
miles per kWh
$
Trip fuel cost—
—

—

Fuel used—
Litres—
CO₂ produced—
Per person—
Electric vehicle equivalent—
Gasoline trip—
EV charging—

—

Metric equivalents

—

Fuel economy by vehicle class

Typical fuel economy for each class, priced at your fuel price above. These are class averages for illustration, not specific model ratings. Check fueleconomy.gov for your vehicle.

—
Vehicle classCity MPGHighway MPGCombined MPGCost / 1,000 miCost / 15,000 mi

MPG, L/100 km and km/L

US MPG converts to metric fuel economy with L/100 km = 235.215 ÷ MPG. Lower L/100 km is better, while higher MPG and km/L are better.

MPG (US)L/100 kmkm/LGallons per 100 miles
Formulas

How the numbers are calculated

Fuel used and cost

gallons = miles ÷ MPG
cost = gallons × price

Measured MPG

MPG = (odometer₂ − odometer₁) ÷ gallons

Emissions and EV

CO₂ = gallons × 8.887 kg
EV cost = miles ÷ (mi/kWh) × price

One US gallon is 3.785412 litres and one mile is 1.609344 km. Burning a gallon of gasoline emits about 8.887 kg of CO₂ (US EPA).

Real-world MPG

Why yours may differ

Speed, acceleration, tire pressure, cold weather, cargo, air conditioning and short trips all lower fuel economy. Highway cruising at moderate speed is usually the most efficient.

Tracking several fill-ups gives a better average than a single one.

Worked examples

Illustrative trips, each checked by hand. The first is the default setup.

340-mile trip

28.5 MPG, gas at $3.55 a gallon.

340 ÷ 28.5 = 11.93 gal
11.93 × 3.55 = $42.35
CO₂ = 11.93 × 8.887 = 106.0 kg
EV: 340 ÷ 3.5 = 97.1 kWh × 0.16 = $15.54

MPG from a fill-up

Odometer 48,250 to 48,590, and 11.93 gallons added.

340 miles ÷ 11.93 gal = 28.5 MPG
235.215 ÷ 28.5 = 8.25 L/100 km
cost per mile = 3.55 ÷ 28.5 = $0.125

Splitting a road trip

340 miles each way, four people.

round trip = 680 mi
680 ÷ 28.5 × 3.55 = $84.70
÷ 4 = $21.18 each

How to calculate gas mileage

  • Fill the tank and note the odometer, or reset the trip meter.
  • Drive as normal, then fill up again and record the gallons added.
  • Divide the miles driven by the gallons added to get miles per gallon.
  • Repeat a few times and average the results for a reliable figure.

To budget a trip, divide its distance by your MPG for gallons, then multiply by the price of gas along the route.

By Suhaib Hassan · Reviewed 29 September 2026 · How CalculatePilot verifies formulas →

Sources

  • U.S. EPA, Greenhouse Gas Emissions from a Typical Passenger Vehicle (8,887 grams of CO₂ per gallon of gasoline).
  • U.S. Department of Energy and EPA, fueleconomy.gov.
  • NIST Special Publication 811, for gallon, litre, mile and kilometre conversion factors.

Frequently asked questions

How do I calculate miles per gallon?

Divide the miles you drove by the gallons of fuel you used. If you drove 340 miles and added 11.93 gallons at the next full fill-up, your fuel economy is 340 ÷ 11.93 = 28.5 MPG.

How do I convert MPG to L/100 km?

Divide 235.215 by the US MPG figure. For example, 28.5 MPG is 8.25 L/100 km. The same formula converts back: MPG = 235.215 ÷ L/100 km. UK gallons are larger, so UK MPG uses 282.481.

How is the carbon emission worked out?

The EPA gives 8,887 grams (8.887 kg) of CO₂ for each gallon of gasoline burned. Multiply gallons used by that factor for the tailpipe CO₂ of the trip. It does not include emissions from producing the fuel.

How does the EV comparison work?

Enter miles per kWh (many EVs manage 3 to 4) and your electricity price. Trip miles divided by miles per kWh gives kWh used, and multiplying by the price gives the charging cost. Public fast chargers cost more than home charging.

Why is my MPG lower in winter?

Cold engines run richer, cold air is denser, tires lose pressure, and winter fuel blends and heating use energy. Short trips make it worse because the engine spends more time warming up.

Related calculators

More everyday tools.

All Everyday Calculators

Embed This Gas Mileage Calculator

Free and responsive, and it runs in the visitor's browser. Branding removal from $7.99/month.

<iframe src="https://www.calculatepilot.com/embed/gas-mileage-calculator.html" width="100%" height="560" loading="lazy" title="Gas Mileage Calculator"></iframe>
For website owners

Want this calculator on your own website?

Embed it in one line of code. Keep it free with a small CalculatePilot attribution link, or go white-label: your brand, no attribution, one license for all your domains.

  • All 159 calculators, unlimited embeds
  • Works on WordPress, Webflow, Squarespace, Wix and plain HTML
  • Runs in your visitor's browser, so nothing is sent to a server
  • License key emailed automatically after checkout, cancel anytime
$7.99 / month
or $89.99 / year · white-label Pro
Get the white-label license Embed free with attribution