MPG Calculator Formula

Understand the math behind the mpg calculator. Each variable explained with a worked example.

Formulas Used

Miles Per Gallon

mpg = miles_driven / gallons_used

Liters per 100 km

liters_per_100km = 235.215 / (miles_driven / gallons_used)

Fuel Cost per 100 Miles (@$3.50/gal)

cost_at_350 = 100 / (miles_driven / gallons_used) * 3.50

Variables

VariableDescriptionDefault
miles_drivenMiles Driven(miles)350
gallons_usedGallons Used(gal)12.5

How It Works

How to Calculate MPG

Divide the total miles driven by the gallons of fuel consumed.

Formula

MPG = Miles Driven / Gallons Used

Conversion to L/100km

L/100km = 235.215 / MPG

Worked Example

You drove 350 miles and used 12.5 gallons.

miles_driven = 350gallons_used = 12.5
  1. 01MPG = 350 / 12.5 = 28.0 MPG
  2. 02L/100km = 235.215 / 28.0 = 8.4 L/100km
  3. 03Fuel cost per 100 miles = 100/28 x $3.50 = $12.50

Frequently Asked Questions

What is good MPG?

Average new car MPG is about 25-30 combined. Hybrids get 40-60 MPG. Trucks and SUVs typically get 15-25 MPG.

How do I accurately measure MPG?

Fill your tank completely, reset the trip odometer, drive normally, then fill up again. Divide miles driven by gallons to refill.

What affects MPG?

Speed, acceleration habits, tire pressure, vehicle weight, wind resistance, terrain, air conditioning use, and engine maintenance all affect fuel economy.

Learn More

Guide

Fuel Economy Guide - Understanding MPG and Fuel Costs

Learn how to calculate fuel economy, compare MPG ratings, and estimate trip fuel costs. Covers miles per gallon, liters per 100 km, and money-saving driving tips.

Ready to run the numbers?

Open MPG Calculator