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 Cost Calculator (Trip Fuel Cost from Distance, MPG and Gas Price)

Enter the distance, fuel economy and gas price. The calculator finds the fuel you need (liters) and the fuel cost.

You can choose km/L (distance per liter) or L/100km (fuel needed for 100 km) for fuel economy. For a round trip, enter the round-trip distance (twice the one-way distance).
Result
Enter the distance, fuel economy and gas price in the fields on the left and press "Calculate". The result will appear here.

What you can do on this page

  • Enter the distance (miles), fuel economy and gas price ($ per gallon), and you get the gallons of gas you need and the fuel cost on the spot
  • Fuel economy can be entered in mpg (miles per gallon) or in gallons per 100 miles, the two numbers on the EPA fuel economy label. Switch "Units" to Metric to use km, km/L or L/100km and $ per liter
  • A comparison table shows how the cost changes if your fuel economy is better or worse than now (5 levels)
  • A plain-language explanation of the formulas and copy-and-paste formulas for Excel, Google Sheets and Python are all on this page
Gas prices change from day to day and differ by state and by gas station. For the price, enter the recent pump price at the station where you actually fill up. Real fuel economy also changes with road conditions, passengers, air conditioning and so on, so the result is an estimate.

What is this calculation used for?

Estimating the gas cost of a road trip before you leave

Driving 400 miles in a car that gets 25 mpg with gas at $3.20 a gallon takes about 16 gallons of gas, about $51.20. The round trip is about $102.40.
Add tolls and parking, and you can estimate the total before you leave. This makes planning a trip budget easier, and you can compare driving with flying or taking the train using real numbers instead of a guess.

Knowing your monthly gas cost for commuting (household budget)

A 15-mile commute each way for 20 workdays a month is 600 miles a month. At 25 mpg and $3.20 a gallon, that is 24 gallons, about $76.80 a month, or about $921.60 a year.
It is money that goes out almost every month, so putting a correct estimate in your budget as a regular expense makes managing your money easier.

Finding out how much a more fuel-efficient car saves each year

If you drive 12,000 miles a year and switch from a 20 mpg car to a 40 mpg car, the gas you use drops by half, from 600 gallons to 300 gallons. At $3.20 a gallon, that saves about $960 a year.
Hybrids and other fuel-efficient cars often cost more to buy, so being able to calculate "how many years it takes to earn back the price gap through lower gas costs" is a big help when choosing a car (the real difference depends on your real-world mpg and driving).

Comparing the cost of driving with public transit

For a 50-mile trip each way, a 25 mpg car at $3.20 a gallon uses about $6.40 of gas one way. Compare that with the train or bus fare, and you can see right away which is cheaper.
When several people ride together, the car's cost can be split among them, but a car also has parking fees and tolls. Getting the gas cost right is the starting point for this kind of comparison.

Estimating the fuel cost of a work vehicle (sales and delivery)

A work car that is driven 2,000 miles a month at 25 mpg uses 80 gallons of gas, about $256 a month at $3.20 a gallon.
In trucking, delivery, sales and other jobs that depend on driving, this calculation is the base for operating costs and pricing. Keep in mind that the IRS standard mileage rate for business driving (70 cents per mile for 2025) covers more than gas: it also includes wear, maintenance, insurance and depreciation.

Formula

Fuel needed (fuel economy in mpg)
Standard notation (the usual math form)
\(F\) \(=\) \(d\) \(\div\) \(e\)
In words (symbols replaced with words)
③ \(F\): fuel needed (gal) \(=\) ① \(d\): distance (mi) \(\div\) ② \(e\): fuel economy (mpg)
The formula in words
① Take the \(d\): distance (mi)
② divide it by the \(e\): fuel economy (mpg)
③ and you get the \(F\): fuel needed (gal)
Quick example
The fuel needed to drive 300 miles in a car that gets 25 mpg is
\(F\): fuel needed (gal) \(=\) distance (300 miles) \(\div\) fuel economy (25 mpg)
\(300 \div 25 = 12\)
Key idea
Fuel economy in mpg tells you how many miles 1 gallon of gas takes you. Divide the distance by "miles per 1 gallon", and you get how many gallons' worth of miles the trip is, which is the amount of gas you need. The EPA rating on the window sticker is measured under set test conditions, so your real-world fuel economy is often lower. If you work out your real mpg from your own fill-up records and use it here, the estimate becomes much more accurate.
Fuel needed (fuel economy in gallons per 100 miles)
Standard notation (the usual math form)
\(F\) \(=\) \(d\) \(\times\) \(e\) \(\div\) \(100\)
In words (symbols replaced with words)
④ \(F\): fuel needed (gal) \(=\) ① \(d\): distance (mi) \(\times\) ② \(e\): fuel economy (gal/100mi) \(\div\) ③ 100 (per 100 miles → per 1 mile)
The formula in words
① Take the \(d\): distance (mi)
② multiply it by the \(e\): fuel economy (gal/100mi)
③ divide it by 100
④ and you get the \(F\): fuel needed (gal)
Quick example
The fuel needed to drive 500 miles in a car rated at 4 gallons per 100 miles (it uses 4 gallons every 100 miles) is
\(F\): fuel needed (gal) \(=\) distance (500 miles) \(\times\) fuel economy (4 gal/100mi) \(\div\) 100
\(500 \times 4 \div 100 = 20\)
Key idea
Fuel economy in gallons per 100 miles tells you how much gas it takes to drive 100 miles. Divide the distance by 100 to see how many "100-mile chunks" the trip has, then multiply by the gallons per 100 miles, \(e\), to get the gas you need. (The formula \(d \times e \div 100\) just does the same steps in a different order.) Unlike mpg, a smaller number of gallons per 100 miles means better fuel economy. The EPA label shows it next to mpg because it makes comparing fuel use easier. In Europe, Canada and Australia, the same idea is written as L/100km.
Fuel cost
Standard notation (the usual math form)
\(C\) \(=\) \(F\) \(\times\) \(u\)
In words (symbols replaced with words)
③ \(C\): fuel cost ($) \(=\) ① \(F\): fuel needed (gal) \(\times\) ② \(u\): gas price ($/gal)
The formula in words
① Take the \(F\): fuel needed (gal)
② multiply it by the \(u\): gas price ($/gal)
③ and you get the \(C\): fuel cost ($)
Quick example
With 12 gallons of gas needed (the example for formula 1) and a gas price of $3.20 per gallon, the fuel cost is
\(C\): fuel cost ($) \(=\) fuel needed (12 gal) \(\times\) price ($3.20/gal)
\(12 \times 3.20 = 38.40\)
Key idea
Gas prices move with crude oil prices and change from day to day. They also differ a lot from state to state and from station to station. Use the recent price at the station where you actually fill up. For a round trip, double the distance (250 miles each way is 500 miles in total). Traffic and air conditioning change your fuel economy even on the same road, so it is wise to leave some room in your estimate.
To find the cost of gas, first find the gallons you need with "distance ÷ fuel economy (mpg)", then multiply by the gas price ($ per gallon). If your fuel economy is in gallons per 100 miles, the gallons you need are "distance × fuel economy ÷ 100".

Symbols and terms

Symbols

\(d\) Distance. How far you drive, in miles. It is the first letter of "distance".
\(e\) Fuel economy, in mpg (miles per gallon) or in gallons per 100 miles. It is the first letter of "efficiency".
\(F\) Fuel needed. The amount of gas the trip takes, in gallons. It is the first letter of "fuel".
\(u\) Gas price. The price of 1 gallon of gas ($ per gallon). It is the first letter of "unit price".
\(C\) Fuel cost ($). It is the first letter of "cost".

Terms

fuel economy How efficiently a car uses fuel. In the US it is usually written as miles per gallon (mpg); the larger the number, the farther the car goes on less gas. It is also called gas mileage.
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. (In Japan, km/L is used 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.
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 often gives lower numbers.
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 work it out yourself from the miles driven and the gallons you put in.
gallon (gal) A unit of volume. In the US, gas is sold by the gallon, and the pump shows how many gallons you put in. One US gallon is about 3.785 liters.

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.

Division and decimals (Grades 4–5)
  • Being able to do a division such as \(300 \div 25\)
  • Being able to give a decimal answer when the division does not come out even, as in \(500 \div 30 = 16.66\ldots\)
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 ÷ amount per 1 = how many of those units"
Proportional relationships (Grades 6–7)
  • Understanding the proportional relationship that if you drive twice as far, you use twice as much gas and pay twice as much
Reading units (elementary to middle school)
  • Being comfortable reading "B per A" units such as mpg (miles per gallon)
  • 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 fuel needed (mpg)
Distance (mi) 300
Fuel economy (mpg) 25
Fuel needed (gal) =B1/B2
Table to find the fuel needed (gal/100mi)
Distance (mi) 500
Fuel economy (gal/100mi) 4
Fuel needed (gal) =B1*B2/100
Table to find the fuel cost
Fuel needed (gal) 12
Gas price ($/gal) 3.20
Fuel cost ($) =B1*B2
After pasting, B1 and B2 are your inputs and B3 is calculated automatically.
The first table is the example of 300 miles at 25 mpg, and B3 shows 12 (gallons). The second table is for fuel economy in gallons per 100 miles, and B3 shows 20 (gallons).
The third table multiplies the fuel needed by the price, and B3 shows 38.4 ($38.40). 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 fuel needed (mpg)
Distance (mi) 300
Fuel economy (mpg) 25
Fuel needed (gal) =B1/B2
Table to find the fuel needed (gal/100mi)
Distance (mi) 500
Fuel economy (gal/100mi) 4
Fuel needed (gal) =B1*B2/100
Table to find the fuel cost
Fuel needed (gal) 12
Gas price ($/gal) 3.20
Fuel cost ($) =B1*B2
These formulas use only 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

distance_mi = 300          # distance (miles)
efficiency_mpg = 25        # fuel economy (mpg)
price_per_gal = 3.20       # gas price ($ per gallon)

# fuel needed (gal) = distance ÷ fuel economy (mpg)
fuel_gal = distance_mi / efficiency_mpg
# fuel cost ($) = fuel needed × price
cost = fuel_gal * price_per_gal

print(f"Fuel needed: {fuel_gal:.2f} gal")
print(f"Fuel cost: ${cost:.2f}")

# if your fuel economy is in gallons per 100 miles, use this line instead
# fuel_gal = distance_mi * efficiency_gal_per_100mi / 100
Runs with the standard library only. Replace the first three values (distance, fuel economy and price) with your own and run it. If your fuel economy is in gallons per 100 miles, use the formula in the comment instead.

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

Fuel needed (fuel economy in mpg)
F = d ÷ e
F = \frac{d}{e}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <mi>F</mi>
    <mo>=</mo>
    <mfrac><mi>d</mi><mi>e</mi></mfrac>
  </mrow>
</math>
F = d / e
fuel = distance/efficiency
F := d/e;
F = d/e;
F = d/e
Fuel needed (fuel economy in gallons per 100 miles)
F = d × e ÷ 100
F = \frac{d \times e}{100}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <mi>F</mi>
    <mo>=</mo>
    <mfrac>
      <mrow><mi>d</mi><mo>&#xD7;</mo><mi>e</mi></mrow>
      <mn>100</mn>
    </mfrac>
  </mrow>
</math>
F = (d * e) / 100
fuel = distance*efficiency/100
F := d*e/100;
F = d*e/100;
F = d×e/100
Fuel cost
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

How to have ChatGPT  do the calculation

You are a gas cost 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).

A car that gets 25 mpg is driven 300 miles. The gas price is $3.20 per gallon.
Find the gallons of gas needed with "distance (miles) ÷ fuel economy (mpg)".
Find each of the following:
1. The gallons of gas needed
2. The fuel cost ($)
3. The fuel cost for the round trip (600 miles) ($)

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.