Bookmarks    
nPr and nCr    
Random Number    
SD Calculator    
Sample Size    
Percent Error    
Density    
Molarity    
Molar Mass    
Ohm's Law    
Watts to Amps    
Voltage Drop    
Long Division    
Mixed Numbers    
Rounding    
Nth Root    
Exponents    
Half-Life    
Polar Form    
De Moivre    
3D Distance    
Point to Line    
Cross Product    
Determinant    
Sin Cos Tan    
Triangle Area    
Scale Factor    
Sector Area    
Ellipse Area    
Cube Volume    
Box Volume    
Sphere Volume    
Cone Volume    
Pipe Volume    
Time Duration    
Time Card    
Present Value    
Future Value    
Churn Rate    
A/B Test Calc    
SEO Traffic    
Ideal Weight    
Fat Intake    
Child Height    
Golf Handicap    
Heat Index    
Wind Chill    
Dew Point    
Download Time    
kWh to Cost    
AC Size (BTU)    
Heating Costs    
LED Savings    
Trip Gas Cost    
Tire Size    
Solar Output    
Solar Payback    
Battery Size    
Wall Area    
Gravel Needed    
Mortar Mix    
Slope Grade    
Curtain Size    
Soil Needed    
Sod Needed    
Ramp Length    
Blind Size    
Drain Slope    
Board Feet    
Heat Loss    
Furniture Fit    
Moving Boxes    
Plywood Cuts    
Shelf Sag    
   Add
Probability and random number calculators
Independent Events
Independent Events
Two Events Solver
Two Events Solver
Repeated Trials
Repeated Trials
Bayes' Theorem
Bayes' Theorem
Expected Value
Expected Value
Binomial Distribution
Binomial Distribution
nPr and nCr
nPr and nCr
Circular Permutation
Circular Permutation
With Repetition
With Repetition
Random Number
Random Number
Averages and statistics calculators
Average Calculator
Average Calculator
Mean Median Mode
Mean Median Mode
SD Calculator
SD Calculator
Quartiles & IQR
Quartiles & IQR
Frequency Table
Frequency Table
Correlation (r)
Correlation (r)
Normal Probability
Normal Probability
Z-Score Calculator
Z-Score Calculator
Confidence Interval
Confidence Interval
Sample Size
Sample Size
Mark & Recapture
Mark & Recapture
P-Value Calculator
P-Value Calculator
Percentage and ratio calculators
Percentage Calc
Percentage Calc
Percent Change
Percent Change
Percent Difference
Percent Difference
Percent Error
Percent Error
Ratio Calculator
Ratio Calculator
Discount Calculator
Discount Calculator
Sales Tax Calculator
Sales Tax Calculator
Margin Calculator
Margin Calculator
Speed calculators
Speed Calculator
Speed Calculator
Density and concentration calculators
Density
Density
Molarity
Molarity
Molar Mass
Molar Mass
Physics and electricity calculators
Ohm's Law
Ohm's Law
Watts to Amps
Watts to Amps
Resistor Colors
Resistor Colors
Voltage Drop
Voltage Drop
Unit conversion calculators
Weight Converter
Weight Converter
Shoe Size Converter
Shoe Size Converter
Integer and signed number calculators
Long Division
Long Division
LCM Calculator
LCM Calculator
GCF Calculator
GCF Calculator
Integer Calculator
Integer Calculator
Prime Factorization
Prime Factorization
Diophantine Solver
Diophantine Solver
Modulo Calculator
Modulo Calculator
Factor Calculator
Factor Calculator
Roman Numerals
Roman Numerals
Fraction, decimal and rounding calculators
Fraction Calculator
Fraction Calculator
Mixed Numbers
Mixed Numbers
Simplify Fractions
Simplify Fractions
Fraction to Decimal
Fraction to Decimal
Decimal to Fraction
Decimal to Fraction
Rounding
Rounding
Equation and inequality calculators
Linear Equation
Linear Equation
Linear Systems
Linear Systems
Quadratic Formula
Quadratic Formula
Absolute Value
Absolute Value
Quadratic Inequality
Quadratic Inequality
Polynomial calculators
Binomial Theorem
Binomial Theorem
Square root and nth root calculators
Simplify Radicals
Simplify Radicals
Nth Root
Nth Root
Exponent and logarithm calculators
Exponents
Exponents
Log Calculator
Log Calculator
Number of Digits
Number of Digits
Scientific Notation
Scientific Notation
Sci. Notation Math
Sci. Notation Math
Half-Life
Half-Life
Complex number calculators
Complex Numbers
Complex Numbers
Polar Form
Polar Form
De Moivre
De Moivre
Function and graph calculators
Slope Calculator
Slope Calculator
Linear Function
Linear Function
Direct & Inverse Variation
Direct & Inverse Variation
y = ax² Calculator
y = ax² Calculator
Distance Formula
Distance Formula
3D Distance
3D Distance
Section Formula
Section Formula
Point to Line
Point to Line
Lat/Long Distance
Lat/Long Distance
Complete the Square
Complete the Square
Circle Equation
Circle Equation
Conic Sections
Conic Sections
Polar Coordinates
Polar Coordinates
Sequence calculators
Arithmetic Sequence
Arithmetic Sequence
Geometric Sequence
Geometric Sequence
Fibonacci Sequence
Fibonacci Sequence
Recurrence Relation
Recurrence Relation
Vector calculators
Vector Calculator
Vector Calculator
Cross Product
Cross Product
Matrix calculators
Matrix Calculator
Matrix Calculator
Determinant
Determinant
Inverse Matrix
Inverse Matrix
Plane geometry calculators
Sin Cos Tan
Sin Cos Tan
Degrees ⇔ Radians
Degrees ⇔ Radians
a sin θ + b cos θ
a sin θ + b cos θ
Triangle Solver
Triangle Solver
Triangle Area
Triangle Area
Right Triangle
Right Triangle
Pythagorean Theorem
Pythagorean Theorem
Polygon Angles
Polygon Angles
Scale Factor
Scale Factor
Parallel Lines
Parallel Lines
Rectangle Area
Rectangle Area
Parallelogram Area
Parallelogram Area
Trapezoid Area
Trapezoid Area
Circle Calculator
Circle Calculator
Sector Area
Sector Area
Inscribed Angle
Inscribed Angle
Ellipse Area
Ellipse Area
Solid geometry calculators
Cube Volume
Cube Volume
Cube Surface Area
Cube Surface Area
Box Volume
Box Volume
Box Surface Area
Box Surface Area
Cylinder Volume
Cylinder Volume
Cylinder Surface
Cylinder Surface
Sphere Volume
Sphere Volume
Sphere Surface
Sphere Surface
Spherical Cap Volume
Spherical Cap Volume
Cap Surface Area
Cap Surface Area
Ellipsoid Volume
Ellipsoid Volume
Ellipsoid Surface
Ellipsoid Surface
Pyramid Volume
Pyramid Volume
Pyramid Surface
Pyramid Surface
Cone Volume
Cone Volume
Cone Surface Area
Cone Surface Area
Frustum Volume
Frustum Volume
Frustum Surface Area
Frustum Surface Area
Pipe Volume
Pipe Volume
Capsule Volume
Capsule Volume
Capsule Surface Area
Capsule Surface Area
Date and time calculators
Age Calculator
Age Calculator
Days Between Dates
Days Between Dates
Date Calculator
Date Calculator
Hours From Now
Hours From Now
Day of the Week
Day of the Week
Time Calculator
Time Calculator
Time Zone Converter
Time Zone Converter
Hours Calculator
Hours Calculator
Time Duration
Time Duration
Time Card
Time Card
Finance and economics calculators
Compound Interest
Compound Interest
Simple Interest
Simple Interest
Interest Calculator
Interest Calculator
TVM Calculator
TVM Calculator
Present Value
Present Value
Future Value
Future Value
ROI Calculator
ROI Calculator
IRR Calculator
IRR Calculator
Payback Period
Payback Period
Average Return
Average Return
GDP Calculator
GDP Calculator
Web marketing and ad metric calculators
CTR Calculator
CTR Calculator
Conversion Rate
Conversion Rate
CPC, CPM & CPA
CPC, CPM & CPA
ROAS Calculator
ROAS Calculator
Break-Even CPA
Break-Even CPA
LTV Calculator
LTV Calculator
CAC Calculator
CAC Calculator
Churn Rate
Churn Rate
A/B Test Calc
A/B Test Calc
A/B Sample Size
A/B Sample Size
SEO Traffic
SEO Traffic
Break-Even Point
Break-Even Point
Markup vs. Margin
Markup vs. Margin
CAGR Calculator
CAGR Calculator
Health and fitness calculators
BMI Calculator
BMI Calculator
Sleep Calculator
Sleep Calculator
Calorie Calculator
Calorie Calculator
BMR Calculator
BMR Calculator
TDEE Calculator
TDEE Calculator
Ideal Weight
Ideal Weight
Body Fat Calculator
Body Fat Calculator
Lean Body Mass
Lean Body Mass
Calories Burned
Calories Burned
Protein Intake
Protein Intake
Macro Calculator
Macro Calculator
Carb Calculator
Carb Calculator
Fat Intake
Fat Intake
Child Height
Child Height
Sports calculators
Golf Handicap
Golf Handicap
Pace Calculator
Pace Calculator
1RM Calculator
1RM Calculator
Target Heart Rate
Target Heart Rate
Weather calculators
Heat Index
Heat Index
Wind Chill
Wind Chill
Dew Point
Dew Point
Computer calculators
Base Converter
Base Converter
Subnet Calculator
Subnet Calculator
Download Time
Download Time
Household energy and budget calculators
Electricity Cost
Electricity Cost
kWh to Cost
kWh to Cost
Yearly kWh to Cost
Yearly kWh to Cost
AC Size (BTU)
AC Size (BTU)
AC Running Cost
AC Running Cost
Heating Costs
Heating Costs
Gas vs Electric
Gas vs Electric
LED Savings
LED Savings
Salary Calculator
Salary Calculator
Budget Calculator
Budget Calculator
Car calculators
Trip Gas Cost
Trip Gas Cost
EV Charging Cost
EV Charging Cost
EV vs Gas Cost
EV vs Gas Cost
MPG Calculator
MPG Calculator
Tire Size
Tire Size
Solar power and battery calculators
Solar Output
Solar Output
Solar Panel Count
Solar Panel Count
Solar Payback
Solar Payback
Battery Size
Battery Size
Home and DIY calculators
Tile Calculator
Tile Calculator
Stair Calculator
Stair Calculator
Concrete Volume
Concrete Volume
Wall Area
Wall Area
Wallpaper Rolls
Wallpaper Rolls
Paint Calculator
Paint Calculator
Flooring Needed
Flooring Needed
Exterior Walls
Exterior Walls
Gravel Needed
Gravel Needed
Mortar Mix
Mortar Mix
Slope Grade
Slope Grade
Lumber Cut List
Lumber Cut List
Lot Coverage/FAR
Lot Coverage/FAR
Sheet Vinyl Roll
Sheet Vinyl Roll
Insulation Needed
Insulation Needed
Curtain Size
Curtain Size
TV Size & Distance
TV Size & Distance
Soil Needed
Soil Needed
Sod Needed
Sod Needed
Block Calculator
Block Calculator
Brick Calculator
Brick Calculator
Deck Materials
Deck Materials
Ramp Length
Ramp Length
Pilot Hole Size
Pilot Hole Size
Room Ventilation
Room Ventilation
Paint Thinning
Paint Thinning
Baseboard & Trim
Baseboard & Trim
Blind Size
Blind Size
Picture Hanging
Picture Hanging
Drain Slope
Drain Slope
Screw Calculator
Screw Calculator
Board Feet
Board Feet
Fence Calculator
Fence Calculator
Wood Shrinkage
Wood Shrinkage
Caulk Calculator
Caulk Calculator
Heat Loss
Heat Loss
Furniture Fit
Furniture Fit
Moving Boxes
Moving Boxes
Storage Capacity
Storage Capacity
Plywood Cuts
Plywood Cuts
Shelf Sag
Shelf Sag

Gas Mileage Calculator (Real-World MPG from a Fill-Up)

Fill the tank all the way up twice in a row. Enter the odometer reading at each fill-up and the amount of fuel you put in this time. The calculator finds your real-world fuel economy with the fill-up method.

The gas price can be left blank (if you enter it, the cost of the fill-up and the gas cost per km are also shown). If you reset your trip meter at the last fill-up, you can enter 0 as the previous reading and the trip meter reading as the current one.
Result
Enter the odometer readings and the gallons you put in on the left and press "Calculate". The result will appear here.

What you can do on this page

  • Enter the odometer readings from your last fill-up and this one, plus the gallons you put in, and you get your real-world mpg on the spot (the fill-up method)
  • The result is shown both in mpg (miles per gallon) and in gallons per 100 miles, the two numbers on the EPA fuel economy label. Switch "Units" to Metric to get km/L and L/100km instead
  • Enter the gas price ($ per gallon, optional), and you also get the cost of the fill-up and the gas cost per mile
  • A plain-language explanation of the formulas and copy-and-paste formulas for Excel, Google Sheets and Python are all on this page
This calculation works only when you filled the tank all the way up both last time and this time (the fill-up method). If you added gas in between, or one of the two was not a full tank, the gallons you put in do not match the gas you used, and the mpg will be off.

What is this calculation used for?

Knowing your car's real-world mpg to estimate running costs correctly

The EPA rating on the window sticker is measured under set test conditions, so your real-world fuel economy is often lower, depending on how and where you drive. Once you measure your own mpg with the fill-up method, you can estimate your monthly gas bill and trip costs with your car's true numbers.
All you do is write down the odometer reading and the gallons at each fill-up, so anyone can keep it up without special tools. Many fuel-tracking apps work the same way.

Checking the effect of fuel-saving driving with numbers

Avoiding hard starts and quick acceleration, keeping your tires at the right pressure, taking extra weight out of the car: if you track your mpg with the fill-up method, you can see the effect of these habits in numbers.
For example, if you drive 12,000 miles a year and raise your real-world fuel economy from 24 mpg to 26 mpg, the gas you use drops from 500 gallons to about 461.5 gallons, about 38.5 gallons less. At $3.20 a gallon, that saves about $123 a year.

Using mpg as an early sign that something is wrong with the car

If your car usually gets about 25 mpg and suddenly drops below 21 mpg without any change in how you drive, it may be a sign of low tire pressure or an engine problem.
A fuel economy record cannot tell you what is broken, but it is a simple health check that gives you a reason to take the car in for an inspection.

Knowing your gas cost per mile for commuting and errands (household budget)

At 25 mpg and $3.20 a gallon, each mile costs about $0.128 in gas (about 13 cents). A 20-mile commute each way is 40 miles a day, about $5.12, or about $102.40 for 20 workdays a month. Just multiply the miles by 12.8 cents.
Knowing "how much per mile" makes it much easier to compare driving with public transit and to budget for transportation.

Managing fuel costs for work vehicles (trucking and sales)

In trucking, delivery, sales and other jobs that depend on driving, companies track the fuel economy of each vehicle from fill-up records and use it as basic data for fuel budgets and cost calculations.
For example, a delivery van that is driven 3,000 miles a month at 15 mpg uses 200 gallons, about $640 a month at $3.20 a gallon. A fuel economy record helps not only with estimating expenses but also with deciding when to replace a vehicle.

Formula

Distance driven (how far you went since the last fill-up)
Standard notation (the usual math form)
\(d\) \(=\) \(b\) \(-\) \(a\)
In words (symbols replaced with words)
③ \(d\): distance driven (mi) \(=\) ① \(b\): current odometer (mi) \(-\) ② \(a\): previous odometer (mi)
The formula in words
① Take the \(b\): current odometer (mi)
② subtract the \(a\): previous odometer (mi)
③ and you get the \(d\): distance driven (mi)
Quick example
If the odometer read 45,300 miles at this fill-up and 45,000 miles at the last one, the distance driven is
\(d\): distance driven (mi) \(=\) current odometer (45,300 mi) \(-\) previous odometer (45,000 mi)
\(45300 - 45000 = 300\)
Key idea
The odometer shows the total distance the car has ever driven. Subtract the reading at the last fill-up from the reading now, and a single subtraction gives the distance you drove between the two fill-ups. If you reset the trip meter (the resettable distance counter) to 0 at the last fill-up, the trip meter reading now is the distance driven.
Real-world fuel economy (mpg) with the fill-up method
Standard notation (the usual math form)
\(e\) \(=\) \(d\) \(\div\) \(F\)
In words (symbols replaced with words)
③ \(e\): fuel economy (mpg) \(=\) ① \(d\): distance driven (mi) \(\div\) ② \(F\): gallons added (gal)
The formula in words
① Take the \(d\): distance driven (mi)
② divide it by the \(F\): gallons added (gal)
③ and you get the \(e\): fuel economy (mpg)
Quick example
If you drove 300 miles since the last fill-up and it took 12 gallons to fill the tank this time, your real-world fuel economy is
\(e\): fuel economy (mpg) \(=\) distance driven (300 mi) \(\div\) gallons added (12 gal)
\(300 \div 12 = 25\)
Key idea
This is the heart of the fill-up method. You filled the tank last time, drove, and filled it again this time, so the tank is back to the same "full" state. That means the gas you put in this time is exactly the gas you used since the last fill-up. So dividing the miles you drove by the gallons you just put in gives your real-world fuel economy. This only works if you filled the tank all the way up both times. If you added gas in between, add those gallons to the total too. The point where the pump nozzle clicks off changes slightly each time, so a single fill-up has some error. Using several fill-ups together, "total miles ÷ total gallons", gives a more accurate number.
Converting mpg to gallons per 100 miles
Standard notation (the usual math form)
\(e_{100}\) \(=\) \(100\) \(\div\) \(e\)
In words (symbols replaced with words)
③ \(e_{100}\): fuel economy (gal/100mi) \(=\) ① 100 (to get "per 100 miles") \(\div\) ② \(e\): fuel economy (mpg)
The formula in words
① Take 100
② divide it by the \(e\): fuel economy (mpg)
③ and you get the \(e_{100}\): fuel economy (gal/100mi)
Quick example
A fuel economy of 25 mpg, written as gallons per 100 miles (the gas needed to drive 100 miles), is
\(e_{100}\): fuel economy (gal/100mi) \(=\) 100 \(\div\) fuel economy (25 mpg)
\(100 \div 25 = 4\)
Key idea
Gallons per 100 miles is the amount of gas it takes to drive 100 miles. The EPA fuel economy label shows it next to mpg. If 1 gallon takes you \(e\) miles, then 100 miles takes \(100 \div e\) gallons, and that is the conversion. Unlike mpg, a smaller number of gallons per 100 miles means better fuel economy. It also shows savings more fairly: going from 10 to 20 mpg saves 5 gallons per 100 miles, but going from 30 to 40 mpg saves only about 0.83 gallons. In Europe, Canada and Australia, the same idea is written as L/100km.
Cost of the fill-up (when you enter the gas price)
Standard notation (the usual math form)
\(C\) \(=\) \(F\) \(\times\) \(u\)
In words (symbols replaced with words)
③ \(C\): cost of the fill-up ($) \(=\) ① \(F\): gallons added (gal) \(\times\) ② \(u\): gas price ($/gal)
The formula in words
① Take the \(F\): gallons added (gal)
② multiply it by the \(u\): gas price ($/gal)
③ and you get the \(C\): cost of the fill-up ($)
Quick example
With 12 gallons added at $3.20 a gallon, the cost of the fill-up is
\(C\): cost of the fill-up ($) \(=\) gallons added (12 gal) \(\times\) gas price ($3.20/gal)
\(12 \times 3.20 = 38.40\)
Key idea
This is what you paid for this fill-up, and it should be almost the same as the amount on the pump receipt. Gas prices change from day to day and differ by state and by station, so use the price at the station where you filled up. On this calculator the gas price can be left blank (then the cost of the fill-up and the gas cost per mile are not shown).
Gas cost per mile (when you enter the gas price)
Standard notation (the usual math form)
\(k\) \(=\) \(C\) \(\div\) \(d\)
In words (symbols replaced with words)
③ \(k\): gas cost per mile ($/mi) \(=\) ① \(C\): cost of the fill-up ($) \(\div\) ② \(d\): distance driven (mi)
The formula in words
① Take the \(C\): cost of the fill-up ($)
② divide it by the \(d\): distance driven (mi)
③ and you get the \(k\): gas cost per mile ($/mi)
Quick example
If $38.40 of gas took you 300 miles, the gas cost per mile is
\(k\): gas cost per mile ($/mi) \(=\) cost of the fill-up ($38.40) \(\div\) distance driven (300 mi)
\(38.40 \div 300 = 0.128\)
Key idea
Once you know how much each mile costs, you can quickly estimate the cost of any trip. For example, at $0.128 per mile (about 13 cents), a 20-mile commute each way (40 miles round trip) costs \(0.128 \times 40 = 5.12\) dollars a day. This value is the same as "gas price ÷ real-world mpg" (\(C \div d = (F \times u) \div d = u \div e\)); here \(3.20 \div 25 = 0.128\).
With the fill-up method, your real-world mpg is "(current odometer − previous odometer) ÷ gallons added". This assumes you filled the tank all the way up both last time and this time. To get gallons per 100 miles, divide 100 by the mpg.

Symbols and terms

Symbols

\(b\) The current odometer reading (miles), shown when you filled up this time.
\(a\) The previous odometer reading (miles), shown when you filled up last time.
\(d\) Distance driven (miles). How far you drove from the last fill-up to this one, found with \(b - a\). It is the first letter of "distance".
\(F\) Gallons added this time. With the fill-up method, this equals the gas you used since the last fill-up. It is the first letter of "fuel".
\(e\) Real-world fuel economy (mpg). How many miles you actually drove on 1 gallon of gas. It is the first letter of "efficiency".
\(e_{100}\) Fuel economy in gallons per 100 miles, the gas needed to drive 100 miles. It is found with \(100 \div e\).
\(u\) Gas price. The price of 1 gallon of gas ($ per gallon). It is the first letter of "unit price".
\(C\) Cost of the fill-up ($). What you paid this time, found with gallons × price. It is the first letter of "cost".
\(k\) Gas cost per mile ($ per mile). What each mile of driving cost you in gas.

Terms

odometer The meter that shows the total distance a car has ever driven. It is on the instrument panel and cannot be reset. The mileage it shows is also used when a used car is valued.
trip meter A distance counter you can reset to 0 at any time with a button (also called a trip odometer). If you reset it at the last fill-up, its reading now is the distance driven since then.
fill-up method A way to measure real-world mpg by dividing the miles driven between two full fill-ups by the gallons it took to fill the tank the second time (also called the tank-to-tank method). It needs no special tools, only your fill-up records.
fuel economy How efficiently a car uses fuel, also called gas mileage. In the US it is usually written as miles per gallon (mpg); the larger the number, the farther the car goes on less gas.
real-world fuel economy The fuel economy you actually get. It changes with road conditions, driving style, air conditioning, passengers and so on, and is often lower than the EPA rating. You can measure it yourself with the fill-up method on this page.
EPA rating The official fuel economy on a new car's window sticker (the Fuel Economy and Environment Label). It comes from standard EPA tests and is shown as city, highway and combined mpg. Real driving usually differs from it.
mpg (miles per gallon) The unit of fuel economy that tells how many miles a car goes on 1 gallon of gas. It is the number used on US window stickers and in everyday talk. The larger the number, the better the fuel economy. (Japan uses km/L the same way.)
gal/100mi (gallons per 100 miles) The unit of fuel economy that tells how many gallons it takes to drive 100 miles. It appears on the EPA label next to mpg. Unlike mpg, a smaller number means better fuel economy. Europe, Canada and Australia use the metric version, L/100km.

Good to know before you start

Here is what helps you use the calculation on this page with real understanding, not just by pressing the button.
If you get stuck, going back to these topics is the quickest way forward.

Subtracting large numbers (Grades 2–3)
  • Being able to subtract large numbers, such as \(45300 - 45000\)
Division and decimals (Grades 4–5)
  • Being able to give a decimal answer when the division does not come out even, as in \(300 \div 8 = 37.5\)
  • Being able to divide by a decimal, as in \(100 \div 12.5\)
Unit rates (Grade 6)
  • Understanding "the amount per 1", such as how many miles a car goes per gallon (that is exactly what mpg is)
  • Understanding that "total amount ÷ how many units = amount per 1 unit"
Reading units (elementary to middle school)
  • Being comfortable reading "B per A" units such as mpg and gallons per 100 miles
  • Knowing that the gallon is a unit of volume and that gas is sold at a price per gallon

How to calculate it in Excel

Copy the whole table below and paste it into cell A1 in Excel. It works as is.
Table to find the distance driven
Current odometer (mi) 45300
Previous odometer (mi) 45000
Distance driven (mi) =B1-B2
Table to find the fuel economy (mpg)
Distance driven (mi) 300
Gallons added (gal) 12
Fuel economy (mpg) =B1/B2
Table to convert to gallons per 100 miles
Fuel economy (mpg) 25
Fuel economy (gal/100mi) =100/B1
Table to find the cost of the fill-up
Gallons added (gal) 12
Gas price ($/gal) 3.20
Cost of the fill-up ($) =B1*B2
Table to find the gas cost per mile
Cost of the fill-up ($) 38.40
Distance driven (mi) 300
Gas cost per mile ($/mi) =B1/B2
After pasting, B1 and B2 are your inputs and the last row is calculated automatically.
The first table subtracts the odometer readings, and B3 shows 300 (miles). The second table is the fill-up method itself, and B3 shows 25 (mpg).
The third table converts to gallons per 100 miles, and B2 shows 4. The fourth and fifth tables use the gas price, and B3 shows 38.4 ($38.40) and 0.128 ($ per mile). Just replace B1 and B2 with your own numbers.

How to calculate it in Google Sheets

Copy the whole table below and paste it into cell A1 in Google Sheets. It works as is.
Table to find the distance driven
Current odometer (mi) 45300
Previous odometer (mi) 45000
Distance driven (mi) =B1-B2
Table to find the fuel economy (mpg)
Distance driven (mi) 300
Gallons added (gal) 12
Fuel economy (mpg) =B1/B2
Table to convert to gallons per 100 miles
Fuel economy (mpg) 25
Fuel economy (gal/100mi) =100/B1
Table to find the cost of the fill-up
Gallons added (gal) 12
Gas price ($/gal) 3.20
Cost of the fill-up ($) =B1*B2
Table to find the gas cost per mile
Cost of the fill-up ($) 38.40
Distance driven (mi) 300
Gas cost per mile ($/mi) =B1/B2
These formulas use only subtraction, multiplication and division, so the same formulas as in Excel work as is. Copy the whole table, paste it into cell A1, and replace B1 and B2 with your own numbers.

How to calculate it in Python

current_odometer_mi = 45300    # current odometer (miles)
previous_odometer_mi = 45000   # previous odometer (miles)
fuel_gal = 12                  # gallons added this time
price_per_gal = 3.20           # gas price ($ per gallon)

# distance driven (miles) = current odometer − previous odometer
distance_mi = current_odometer_mi - previous_odometer_mi
# fuel economy (mpg) = distance ÷ gallons added (fill-up method)
mpg = distance_mi / fuel_gal
# gallons per 100 miles = 100 ÷ mpg
gal_per_100mi = 100 / mpg
# cost of the fill-up ($) and gas cost per mile ($/mi)
cost = fuel_gal * price_per_gal
cost_per_mile = cost / distance_mi

print(f"Distance driven: {distance_mi} mi")
print(f"Fuel economy: {mpg:.2f} mpg ({gal_per_100mi:.2f} gal/100mi)")
print(f"Cost of the fill-up: ${cost:.2f}")
print(f"Gas cost per mile: ${cost_per_mile:.3f}/mi")
Runs with the standard library only. Replace the first four values (the two odometer readings, gallons added and price) with your own and run it. It assumes you filled the tank all the way up both last time and this time.

How to write it in LaTeX and other math languages (copy and paste)

Distance driven (how far you went since the last fill-up)
d = b − a
d = b - a
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <mi>d</mi>
    <mo>=</mo>
    <mi>b</mi>
    <mo>&#x2212;</mo>
    <mi>a</mi>
  </mrow>
</math>
d = b - a
distance = currentOdometer - previousOdometer
d := b - a;
d = b - a;
d = b - a
Real-world fuel economy (mpg) with the fill-up method
e = d ÷ F
e = \frac{d}{F}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <mi>e</mi>
    <mo>=</mo>
    <mfrac><mi>d</mi><mi>F</mi></mfrac>
  </mrow>
</math>
e = d / F
efficiency = distance/fuel
e := d/F;
e = d/F;
e = d/F
Converting mpg to gallons per 100 miles
e₁₀₀ = 100 ÷ e
e_{100} = \frac{100}{e}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <msub><mi>e</mi><mn>100</mn></msub>
    <mo>=</mo>
    <mfrac><mn>100</mn><mi>e</mi></mfrac>
  </mrow>
</math>
e_100 = 100 / e
efficiencyLPer100km = 100/efficiency
e100 := 100/e;
e100 = 100/e;
e_100 = 100/e
Cost of the fill-up (when you enter the gas price)
C = F × u
C = F \times u
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <mi>C</mi>
    <mo>=</mo>
    <mi>F</mi>
    <mo>&#xD7;</mo>
    <mi>u</mi>
  </mrow>
</math>
C = F * u
cost = fuel*price
C := F*u;
C = F*u;
C = F×u
Gas cost per mile (when you enter the gas price)
k = C ÷ d
k = \frac{C}{d}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <mi>k</mi>
    <mo>=</mo>
    <mfrac><mi>C</mi><mi>d</mi></mfrac>
  </mrow>
</math>
k = C / d
costPerKm = cost/distance
k := C/d;
k = C/d;
k = C/d

How to have ChatGPT  do the calculation

You are a fuel economy calculation assistant. Do the following calculation by actually running Python code, and base your answer only on the numbers from the execution result (do not answer by mental math or guessing).

At the last fill-up, the odometer read 45,000 miles. At this fill-up, it read 45,300 miles. It took 12 gallons to fill the tank this time (the tank was filled all the way up both times). The gas price is $3.20 per gallon.
Find each of the following:
1. The distance driven since the last fill-up (miles)
2. The real-world fuel economy by the fill-up method (mpg), and the same value in gallons per 100 miles
3. The cost of this fill-up ($), and the gas cost per mile ($ per mile)

Show the formulas you used and the numbers from the execution result.

How to Use
  1. 1
    Enter your numbers
    Type the numbers you want to calculate with into the input fields
  2. 2
    Calculate
    Press the "Calculate" button
  3. 3
    Check the result
    The result appears on the spot. The same page also explains the idea behind the calculation and the formula
  DataChef Features
Easy and Free
Unlimited conversions for free.
No technical knowledge required.
Intuitive and user-friendly operation.
No Registration Required
Available immediately after access.
Can be used without registering personal information.
Safe and Secure
Fully SSL encrypted communication.
Automatic file deletion by clicking "download".
Fast
High-speed site access
and rapid file conversion.
No Watermark
No watermark.
No attribution required.
Commercial Use Available
Free for commercial use.
No need to contact us for commercial use permission.