The basic formula for gas cost

To find out how much a trip costs in gas, divide the distance you drove by how many miles your car gets per gallon, then multiply by the price per gallon. The formula is: (miles driven ÷ miles per gallon) × price per gallon = gas cost.

For example: if you drove 150 miles, your car averages 25 miles per gallon, and gas costs $3.50 per gallon, the math is (150 ÷ 25) × $3.50 = 6 gallons × $3.50 = $21 for that trip.

You need three pieces of information to make this work: the distance, your car's fuel economy, and the current gas price. Each one affects the result, and small changes in any of them shift your total cost.

Key Takeaways

  • Gas cost per trip = (miles driven ÷ miles per gallon) × price per gallon; a 150-mile trip at 25 mpg and $3.50 per gallon costs $21.
  • Your car's actual fuel economy depends on driving conditions, speed, and maintenance; highway driving uses less gas than city driving in the same car.
  • You can find your fuel economy on the EPA label in your owner's manual, or calculate it yourself by dividing miles driven by gallons pumped at fill-up.
  • Gas prices vary by location and change daily; using your local price at the pump gives you the most accurate cost for your specific trip.
  • Calculating cost per mile helps you compare the fuel expense of different vehicles or routes before you commit to a trip.

Finding your car's miles per gallon

Your car's fuel economy is listed on the EPA label attached to the window when you buy a new vehicle, or in your owner's manual. The label shows three numbers: city mpg, highway mpg, and combined mpg. Use the combined figure for everyday trips that mix both types of driving.

If you do not have the label or manual, you can calculate your actual fuel economy yourself. Fill your tank completely, note the odometer reading, drive normally, then fill up again and note the new odometer reading. Divide the miles you drove by the gallons it took to refill. Do this over several fill-ups to get an average, because one tank can be skewed by a single long highway drive or a week of city traffic.

Real-world fuel economy often differs from the EPA estimate. Aggressive acceleration, idling, cold weather, and carrying heavy loads all reduce mpg. Highway driving at steady speeds uses less gas than stop-and-go city driving in the same vehicle. If you mostly drive in the city, your actual mpg will be lower than the highway figure on the label.

Using current gas prices in your calculation

Gas prices change daily and vary by location. The price you see at the pump is what you should use in your calculation, not a national average or a price from last week. If you are planning a trip and want to estimate cost before you leave, check the current price at a station near your route.

Gas price tracking websites and apps show prices at specific stations in your area, updated frequently. GasBuddy and AAA both publish local prices. For a long trip that crosses multiple states, you might average the prices you expect to pay along the way, or use the highest price you find to avoid underestimating your cost.

If you fill up at different times during the month, your cost per gallon varies. Tracking what you actually paid helps you spot patterns — many drivers find prices are lower on certain days of the week or at particular station brands.

Calculating cost per mile for vehicle comparison

To compare the fuel cost of two different vehicles, calculate the cost per mile for each one. Divide the price per gallon by the miles per gallon: price per gallon ÷ miles per gallon = cost per mile.

At $3.50 per gallon, a car that gets 25 mpg costs $0.14 per mile. A truck that gets 15 mpg costs $0.23 per mile. Over a 300-mile trip, the car costs $42 in gas while the truck costs $69 — a $27 difference. This calculation helps you understand the fuel expense trade-off when you are deciding which vehicle to use for a trip or considering a purchase.

Cost per mile also accounts for changes in gas price. If prices rise to $4.50 per gallon, the car's cost per mile becomes $0.18 and the truck's becomes $0.30. The truck remains more expensive to fuel, but the gap widens as prices climb.

Breaking down a long trip into segments

For trips longer than a few hours, break the distance into segments and calculate gas cost for each one. This matters because fuel economy often changes between city and highway driving, and gas prices can differ between regions.

If you drive 100 miles through the city at 20 mpg, then 200 miles on the highway at 28 mpg, calculate each part separately. City portion: (100 ÷ 20) × $3.50 = $17.50. Highway portion: (200 ÷ 28) × $3.50 = $25. Total: $42.50. If you had used an average of 24 mpg for the whole trip, you would have gotten (300 ÷ 24) × $3.50 = $43.75, which is close but not exact — and the difference grows on longer trips.

Segmenting also lets you see where your fuel cost concentrates. If you cross into a state with higher gas prices, you can calculate that portion separately and understand how much the price difference adds to your total.

Tracking actual gas spending over time

Keeping records of what you spend on gas helps you spot trends and catch problems. Write down the date, odometer reading, gallons pumped, and total cost each time you fill up. Over a month or two, you can calculate your average cost per mile and see whether it is rising.

A sudden drop in fuel economy — your cost per mile climbing while gas prices stay flat — can signal a maintenance issue. A clogged air filter, worn spark plugs, low tire pressure, or misaligned wheels all reduce mpg. If your calculated cost per mile jumps by 10 or 15 percent, have your vehicle inspected.

Tracking also shows you the real cost of driving habits. If you notice your mpg is worse on weeks when you make many short trips, you have data to support switching to fewer, longer trips when possible. Short trips use more gas per mile because the engine burns extra fuel during the cold-start period before it reaches full efficiency.

Tools and shortcuts for quick calculations

You can do the math by hand, but online calculators and spreadsheets speed up the work, especially for complex trips. Fuel cost calculators on websites like FuelEconomy.gov let you enter your vehicle's mpg, the distance, and the gas price, and they return the total cost when ready. Some also show cost per mile and let you compare two vehicles side by side.

A straightforward spreadsheet with columns for date, miles driven, gallons pumped, price per gallon, and cost per mile automates the tracking process. Once you set up the formulas, you just enter the numbers each time you fill up, and the sheet calculates everything else. This approach works well if you want to track spending over months or years.

Phone apps that track fuel economy and spending are available for most platforms. They store your fill-up history, calculate trends, and alert you if your mpg drops unexpectedly. Some sync with your vehicle's onboard computer if your car is recent enough to support it.

Frequently Asked Questions

What if I don't know my car's actual miles per gallon?

Calculate it yourself by filling your tank, driving normally for at least 100 miles, then filling up again and dividing miles driven by gallons pumped. Repeat this three or four times to get an average, because one tank can be skewed by unusual driving. If your car is newer, check the EPA label in your owner's manual or on the window sticker from when it was sold.

Does the formula change for electric or hybrid vehicles?

Yes. Electric vehicles use kilowatt-hours per 100 miles instead of mpg. Hybrids show both mpg and electric-only range. The basic principle is the same — divide distance by efficiency, then multiply by the cost per unit — but the units and prices differ. Check your vehicle's manual for how to calculate efficiency in the format it uses.

Should I use city mpg, highway mpg, or combined mpg?

Use combined mpg for trips that mix city and highway driving. If your trip is almost entirely highway, use the highway figure. If it is almost entirely city, use the city figure. For accuracy on longer trips, calculate city and highway portions separately using their respective mpg numbers.

How accurate is this calculation in real life?

The calculation is accurate within 5 to 10 percent if you use your actual fuel economy and current gas prices. Real-world accuracy depends on how closely your driving conditions match the conditions under which you calculated your mpg. Aggressive driving, heavy loads, and extreme weather all shift actual cost higher than the formula predicts.

Can I use this to budget for gas over a month or year?

Yes, if you track your actual miles driven and fuel economy over time. Calculate your average cost per mile from several fill-ups, then multiply by the miles you expect to drive in a month or year. This gives you a realistic budget figure. Update it quarterly as gas prices and your driving patterns change.