Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Total Gas Cost
$14.00
Distance
100.0 miles
Miles per Gallon (MPG)
25.0
Gas Price
$3.50/gallon
Gas Used
4.00 gallons
Cost per Mile
$0.14/mile

What the Gas Cost Calculator Does

The Gas Cost Calculator estimates how much fuel you'll burn — and how much it will cost — for any car trip. It works with US-style units (miles and miles per gallon), so it's ideal for drivers in the United States. You enter three values, and the tool instantly returns the total trip cost, the number of gallons used, and your cost per mile.

The Inputs You Provide

  • Distance (miles): the total length of your trip in miles.
  • Miles per Gallon (MPG): your vehicle's fuel efficiency — check your dashboard, owner's manual, or fuel-economy sticker.
  • Gas Price (per gallon): the price you pay at the pump, in your local currency.

The Formula

Behind the scenes the calculator uses three simple steps:

  • Gallons used = \(\text{Distance} \div \text{MPG}\)
  • Total cost = \(\text{Gallons used} \times \text{Gas price}\)
  • Cost per mile = \(\text{Total cost} \div \text{Distance}\)

$$\text{Total Cost} = \frac{\text{Distance (mi)}}{\text{MPG}} \times \text{Gas Price}$$

In short, fewer miles per gallon or a higher pump price both push your total cost up, while a longer distance increases both the fuel used and the overall bill.

Diagram showing distance divided by MPG times gas price equals total cost
Total cost is distance divided by MPG, multiplied by the gas price per gallon.

Worked Example

Say you're driving 300 miles in a car that gets 25 MPG, and gas costs $3.50 per gallon.

  • Gallons used = \(300 \div 25 = \) 12 gallons
  • Total cost = \(12 \times \$3.50 = \) $42.00
  • Cost per mile = \(\$42.00 \div 300 = \) $0.14 per mile

So this trip would cost about $42, or 14 cents for every mile driven.

Worked example showing a trip from A to B with fuel used and total cost tiles
A sample trip illustrating gallons used and the resulting total gas cost.

Frequently Asked Questions

Where do I find my car's MPG? Most modern vehicles display average MPG on the trip computer. You can also look up your model's rated city/highway MPG, or calculate it yourself by dividing miles driven by gallons filled.

Should I use city or highway MPG? Use the figure that matches your trip. Highway driving is usually more efficient, while stop-and-go city driving lowers your MPG and raises the cost.

Why is cost per mile useful? It lets you compare trips, budget for commuting, or estimate the fuel portion of a reimbursement. Multiply cost per mile by your monthly mileage to project ongoing fuel spending.

Last updated: