THE NUMORIX GUIDE
How to use the Gas Mileage Calculator
Last reviewed September 14, 2026
What this calculator does
The engine converts the entered distance to both miles and kilometers and the fuel amount to both gallons and liters.
Formula and method
The engine converts the entered distance to both miles and kilometers and the fuel amount to both gallons and liters. MPG is miles / gallons, L/100km is liters / kilometers x 100, total cost is gallons x gas price, and cost per mile is total cost / miles. Cost per kilometer is calculated as liters x the entered gas price / kilometers, using the price field as dollars per gallon even when the fuel input is liters.
Variables and inputs
Enter a positive distance in miles or kilometers, positive fuel used in gallons or liters, and gas price in dollars per gallon. The engine reports MPG, L/100km, total cost, cost per mile, cost per kilometer, and total fuel in liters. The UI labels the price as $/gal for both fuel-unit choices.
Worked example
For 300 miles, 10 gallons, and $3.50/gal, MPG is 300 / 10 = 30.00. The converted distance is 482.80 km and fuel is 37.85 L, so L/100km is 37.85 / 482.80 x 100 = 7.84. Total cost is 10 x $3.50 = $35.00, cost per mile is $0.1167, and the engine's cost-per-km result is $0.2744.
How to interpret the result
Higher MPG means fewer gallons per mile, while lower L/100km means better fuel economy. Cost results describe the entered fuel quantity and price; they do not describe maintenance, depreciation, tolls, or the vehicle's full operating cost.
Common mistakes to avoid
Keep gas price in dollars per gallon even when entering fuel in liters, and do not compare a lower L/100km as if it were a lower MPG. Use the same trip distance and fuel quantity from the same fill-up when measuring a vehicle.
Assumptions and limitations
The cost-per-km formula is not unit-consistent with the UI's $/gal label: it multiplies liters by dollars per gallon instead of converting the price to dollars per liter. Weather, traffic, load, tire pressure, driving style, fuel blend, and pump-price changes are also outside the model. Treat cost per kilometer as an implementation-specific output and verify it independently.