Plan your journey and estimate your total fuel costs
km / miles
L/100km or MPG
$
Metric (L/100km)
Imperial (MPG)
Total Fuel Required0L
Total Estimated Cost$0.00
How to Calculate Fuel Expenses
Calculating your fuel expenses is crucial for budgeting long-distance road trips or understanding your monthly commuting costs. This calculator determines how much fuel you will need based on your vehicle's efficiency and calculates the financial impact based on current fuel prices.
Imperial System: Fuel Needed = Distance / Miles Per Gallon (MPG)
Total Cost: Fuel Needed × Price per Unit (Liter or Gallon)
Real-World Example
If you plan a 500-mile road trip in a car that averages 30 MPG, and the average gas price is $3.50 per gallon:
Divide 500 miles by 30 MPG = 16.67 Gallons of fuel required.
Multiply 16.67 Gallons by $3.50 = $58.35 Total Cost.
Tips to Reduce Fuel Costs
You can improve your vehicle's efficiency by maintaining proper tire pressure, removing unnecessary weight from the trunk, and avoiding aggressive acceleration. Using cruise control on highways can also significantly improve your MPG/L/100km rating.
function calculateFuelExpense() {
var distance = parseFloat(document.getElementById('tripDistance').value);
var efficiency = parseFloat(document.getElementById('fuelConsumption').value);
var price = parseFloat(document.getElementById('fuelPrice').value);
var method = document.getElementById('calcMethod').value;
var resultDiv = document.getElementById('fuelResult');
var totalFuelSpan = document.getElementById('totalFuel');
var totalCostSpan = document.getElementById('totalCost');
var unitLabelSpan = document.getElementById('unitLabel');
if (isNaN(distance) || isNaN(efficiency) || isNaN(price) || distance <= 0 || efficiency <= 0 || price <= 0) {
alert('Please enter valid positive numbers for all fields.');
return;
}
var totalFuel;
if (method === 'metric') {
// Metric: (km / 100) * L/100km
totalFuel = (distance / 100) * efficiency;
unitLabelSpan.innerText = 'Liters';
} else {
// Imperial: miles / MPG
totalFuel = distance / efficiency;
unitLabelSpan.innerText = 'Gallons';
}
var totalCost = totalFuel * price;
totalFuelSpan.innerText = totalFuel.toFixed(2);
totalCostSpan.innerText = totalCost.toFixed(2);
resultDiv.style.display = 'block';
// Smooth scroll to results if on mobile
if (window.innerWidth < 768) {
resultDiv.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
}
}