What is gas mileage, and why does the number matter?
Gas mileage is how far your car goes on a unit of fuel. In the US, it's measured in miles per gallon (MPG). Most of the rest of the world uses liters per 100 kilometers (L/100km) or kilometers per liter (km/L). They're the same physical quantity, expressed three different ways.
The number matters because it sets your real cost of driving. A car that gets 20 MPG and a car that gets 40 MPG don't differ by 2x in fuel cost over their lifetime — they differ by 2x, exactly, because the math is linear. Over 150,000 miles at $3.50/gallon, that's $26,250 vs $13,125 in fuel. The MSRP gap between an efficient car and an inefficient one is often smaller than the lifetime fuel gap, which is why fuel economy lives high on the spec sheet.
The Gas Mileage Calculator handles two questions: what MPG am I actually getting (from miles driven and gallons used), and what will this trip cost (from MPG, distance, and fuel price). Numbers in your browser, no signup, no app to install.
The formula (in all three flavors)
The math is one division. The unit conversions are where people trip up.
MPG = miles driven ÷ gallons used
km/L = kilometers driven ÷ liters used
L/100km = (liters used ÷ kilometers driven) × 100
MPG and km/L are "higher is better" measures — how far you go per unit fuel. L/100km is "lower is better" — how much fuel you need to cover a fixed distance. They're not linearly related to each other, which causes some real confusion when comparing cars across markets. We'll come back to that under "MPG vs L/100km" below.
Worked example: you fill up, reset the trip odometer, drive normally, fill up again. The trip odometer reads 350 miles and the pump shows 12 gallons.
- MPG: 350 ÷ 12 = 29.2 MPG
- km/L: (350 × 1.60934) ÷ (12 × 3.78541) = 563.3 ÷ 45.4 = 12.4 km/L
- L/100km: (45.4 ÷ 563.3) × 100 = 8.06 L/100km
The Gas Mileage Calculator reports all three when you compute MPG, so you don't have to convert manually if you're comparing against a European or Japanese car spec.
How to use the Gas Mileage Calculator
The widget has two modes; pick the one that matches your question.
- Compute-MPG mode — you have real data from a fill-up. Enter miles driven since the last fill-up and gallons added at the second fill-up. You get MPG plus the metric equivalents.
- Compute-cost mode — you're planning a drive. Enter trip distance, your car's typical MPG, and the current gas price. You get total trip cost, gallons needed, and cost per mile.
Pick units (US or metric) at the top. The calculator converts internally — you can mix and match if your car spec is in km/L but the gas pump is in dollars per gallon, for example.
How to measure your real MPG (the fill-up-to-fill-up method)
The Gas Mileage Calculator gives you the math, but it can't make up data. The most accurate way to know your real MPG is the fill-up-to-fill-up method. It takes one tank of driving and produces a number you can trust within about 1%.
- Fill the tank to the first auto-shutoff click. Don't top off; the gas pump's first click is the most repeatable stopping point.
- Reset your trip odometer to zero.
- Drive normally for the tank. Don't change your routes or habits to game the number — you want to measure how you actually drive, not how the EPA test cycle drives.
- When the gas light comes on (or whenever you'd normally refill), go to a gas station and fill the tank to auto-shutoff again. Note the gallons on the pump display.
- Note the trip odometer reading before resetting it.
- Divide miles by gallons. That's your real MPG.
Run the method for two or three consecutive tanks to smooth out variance. A single tank can be skewed by one long highway trip or one week of stop-and-go traffic. Three tanks averaged gives you the number to use for budgeting and trip planning.
Compute trip cost: the math behind the second mode
Trip cost is two simple multiplications stacked together.
Gallons needed = Trip distance ÷ MPG
Trip cost = Gallons needed × Price per gallon
Cost per mile = Price per gallon ÷ MPG
Worked example: a 600-mile road trip in a car that gets 28 MPG, with gas at $3.50/gallon.
- Gallons needed: 600 ÷ 28 = 21.43 gallons
- Trip cost: 21.43 × $3.50 = $75.00
- Cost per mile: $3.50 ÷ 28 = $0.125/mile
Cost per mile is the most useful single number for comparing cars or planning routes. At 12.5 cents per mile, a 200-mile detour costs $25 in fuel. A 50-MPG hybrid runs at $0.07/mile at the same gas price; a 15-MPG truck runs at $0.23/mile. Same trip, almost exactly 3x the cost.
Highway vs city MPG: where the EPA numbers come from
The MPG number on a window sticker is actually three numbers: city, highway, and combined. They come from EPA dynamometer test cycles that simulate stop-and-go (city) and steady-cruise (highway) driving.
| Cycle | Avg speed | What it simulates | Typical relative MPG |
|---|---|---|---|
| City (FTP-75) | 21 mph | Frequent stops, acceleration, idling | Lowest for gas cars; HIGHEST for hybrids |
| Highway (HWFET) | 48 mph | Steady cruise, gentle acceleration | 30-50% higher than city for gas cars |
| Combined | — | 55% city / 45% highway weighted average | The single number on the window sticker |
Gas engines run most efficiently at moderate steady load, which is what highway driving provides. Stop-and-go wastes energy on acceleration (kinetic energy gets converted to brake heat) and idling (zero MPG, fuel still consumed). That's why city MPG is typically lower for combustion engines.
Hybrids invert the relationship. Regenerative braking captures the kinetic energy that a gas car loses to brake heat, so hybrids GAIN efficiency from stop-and-go. A Toyota Prius gets higher city MPG (around 58 MPG) than highway (around 53 MPG). Plug-in hybrids and EVs follow the same pattern for the same reason.
MPG vs L/100km: not linearly related, and why that trips people up
If you're shopping for a car and reading specs from both US and European sources, you'll hit a confusing pattern. Going from 20 MPG to 25 MPG saves more fuel than going from 50 MPG to 55 MPG, even though both are "5 MPG better." The L/100km measure makes this obvious; MPG hides it.
| MPG | L/100km | Gallons used for 10,000 miles | Cost at $3.50/gal |
|---|---|---|---|
| 15 | 15.7 | 667 gal | $2,333 |
| 20 | 11.8 | 500 gal | $1,750 |
| 25 | 9.4 | 400 gal | $1,400 |
| 30 | 7.8 | 333 gal | $1,167 |
| 40 | 5.9 | 250 gal | $875 |
| 50 | 4.7 | 200 gal | $700 |
| 60 | 3.9 | 167 gal | $583 |
Look at the "gallons used" column. Moving from 15 MPG to 20 MPG saves 167 gallons over 10,000 miles. Moving from 50 MPG to 60 MPG saves 33 gallons over the same distance — five times less savings, even though both jumps look like a healthy MPG improvement. The diminishing-returns pattern is the reason replacing an old truck with a fuel-efficient sedan has a bigger climate impact than replacing a Prius with a Tesla. Big inefficiencies are where the savings live.
L/100km makes this linear and obvious. Going from 15 L/100km to 10 L/100km saves 5 liters per 100 km, every time, no matter where you started. Most countries outside the US use L/100km because it's the more honest measure of fuel consumption.
Why your dashboard MPG lies (a little)
Most modern cars display an estimated MPG on the dashboard. It's usually 5-10% optimistic compared to fill-up-to-fill-up reality.
The dashboard estimate is computed from injector pulse width — the ECU knows how long each fuel injector was open and uses that to estimate gallons burned. The estimate is then divided by miles from the odometer to get MPG. Two sources of optimism creep in: the ECU's injector model is calibrated for new injectors (real ones get less efficient with age), and the odometer is calibrated to over-report distance very slightly (manufacturers err on this side to keep warranty miles short).
The dashboard isn't lying maliciously. It's an estimate, and like most estimates, it points slightly in the direction that flatters the product. For trip planning and budgeting, trust the fill-up-to-fill-up number you calculated; the dashboard is a quick read-out, not a source of truth.
The three things that actually move your MPG
If you want better fuel economy without buying a different car, three habits matter more than everything else combined.
- Speed. Wind resistance grows with the square of velocity. Every 5 mph over 50 mph costs about 7% MPG. Driving 75 mph instead of 65 mph on a long trip costs ~14% more fuel — turning a $75 tank into a $85.50 tank. The car still gets you there, just with one extra gas station stop and 15-20 minutes saved.
- Acceleration smoothness. Gentle, gradual acceleration is 10-30% more efficient than aggressive. Anticipate stops; lift off the gas early instead of braking late. The cumulative effect over a year is bigger than most engine modifications.
- Tire pressure. Under-inflated tires lose 3-5% MPG and wear out faster. Check pressure monthly when the tires are cold. The recommended pressure is on the door jamb sticker, not the tire sidewall — the sidewall lists the maximum pressure, which is not the recommended pressure.
Smaller factors that add up: roof racks add huge wind drag (10-25% hit at highway speed, even when empty), excess weight in the trunk costs about 1% per 100 lbs, and AC use in stop-and-go traffic adds 5-10%. The "engine tuning" advice you'll see on car forums matters less than people think on modern cars; the ECU is doing most of the tuning already.
Related calculations
Gas mileage is one piece of the cost-of-driving puzzle. These tools handle adjacent ones:
- Mileage Calculator — for IRS mileage reimbursement, business travel deductions, and converting distance into reimbursable dollars at the standard rate.
- Percent Error Calculator — useful for checking how far off your dashboard MPG is from your real fill-up-to-fill-up MPG.
- Average Calculator — for averaging MPG across multiple tanks to smooth out the variance.
- Payment Calculator — when comparing total cost of ownership across cars, fuel cost is one column; the loan payment is another.
Frequently asked questions
How accurate is the trip-cost calculation?
Within about 5-10%, assuming your input MPG is accurate. The biggest source of error is using an EPA highway rating when you do mostly city driving, or vice versa. For best accuracy: use a MPG number you calculated yourself from a recent fill-up-to-fill-up measurement, plug in the actual gas price you'll pay (not the advertised price, which sometimes excludes state taxes), and add a 10-15% buffer for stops, traffic, and any side trips.
What's the difference between MPG and MPGe?
MPG is miles per gallon of gasoline. MPGe is miles per gallon-equivalent — used for electric and plug-in hybrid vehicles. The EPA defines a "gallon-equivalent" as the energy content of a gallon of gas (33.7 kWh), so a car that uses 33.7 kWh to drive 100 miles is rated at 100 MPGe. Most EVs come in between 100-140 MPGe, vs around 30 MPGe for an average gas car. Real-world EV cost per mile depends on local electricity prices, not gasoline prices — usually $0.03-0.05/mile vs $0.10-0.20/mile for a gas car.
Why does my MPG vary so much tank to tank?
Three big variables: driving conditions (highway vs city), weather (cold air is denser, so engines work harder in winter; cold engines run rich during warm-up), and tire pressure. Tank-to-tank variance of 2-4 MPG is normal. If you're seeing more than 5 MPG of variance from a stable baseline, check tire pressure and look for unusual cargo or roof racks. Persistent drops can indicate a stuck thermostat, dragging brakes, or a failing oxygen sensor — worth a mechanic visit if you can't explain it.
Does using AC really cost MPG?
Yes, but less than people think. At highway speeds, AC takes about 1-3% off MPG — barely noticeable. At low speeds and stop-and-go, AC takes 5-10% off, because the compressor load is a bigger fraction of total engine output. The folk advice "roll down windows instead of running AC" is wrong above ~40 mph — open windows add enough aerodynamic drag to cost more than the AC compressor. Below 40 mph, windows win. Defrost mode runs the AC compressor automatically (to dehumidify), so you can't avoid the AC penalty in winter humidity.
Why is my dashboard MPG higher than what this calculator gives me?
The dashboard reads injector pulse width and divides by odometer miles; both are slightly optimistic-biased by design. Manufacturers tune the readout to flatter the driver and to match the rated EPA window-sticker numbers (which are themselves derived from a test cycle that doesn't perfectly match real driving). The fill-up-to-fill-up method using the actual pump gallons and trip odometer miles is the only objective measure. The gap is usually 5-10%; if it's more than 15%, the trip odometer might be miscalibrated.
How do I improve my MPG without buying a different car?
Slow down on the highway (every 5 mph over 50 mph costs ~7%). Accelerate gradually. Keep tires inflated to the door-jamb spec. Remove roof racks when not in use. Avoid idling — modern cars use no measurable extra fuel to restart, so an engine off for more than 10 seconds saves fuel. Stay on top of routine maintenance: a clogged air filter or fouled oxygen sensor can cost 5-10% MPG each. The cumulative effect of all of these is 15-25% better MPG without spending money on a new car.
Is premium gas worth it for MPG?
Only if your car requires it. Premium has a higher octane rating, which prevents knock in high-compression engines. Cars designed for regular fuel gain no MPG benefit from premium; the engine can't extract more energy from gas it isn't tuned for. Cars that recommend (but don't require) premium can get 2-4% better MPG on premium — almost never enough to offset the 50-cent-per-gallon price premium. Cars that require premium will run on regular but with worse MPG, reduced power, and over the long term, engine wear. Follow the owner's manual.
How is the formula different for diesel?
Diesel MPG uses the same math (miles ÷ gallons), but the energy content of diesel fuel is about 13% higher than gasoline, so diesel cars typically get 20-30% better MPG than gas equivalents at similar performance. Diesel is also usually more expensive per gallon than regular gasoline, so the cost-per-mile difference is smaller than the MPG difference suggests. For an apples-to-apples comparison, compute cost per mile (price per gallon ÷ MPG) instead of just looking at MPG.