Gas mileage calculator
Enter the distance and the fuel of a fill-up to see the miles per gallon, the liters per 100 kilometers and the cost per mile. A second tool works out the fuel and the cost of a trip.
What mileage did you get?
This answer is for the example values in the boxes above. 312 miles on 12.4 U.S. gallons, $3.45 a gallon. Change the boxes to see your own answer.
A mile is 1.609344 kilometers and a gallon is 3.785411784 liters, both exact. NIST's rule for the change is to divide 235.215 by the miles per gallon.
How much fuel will a trip take?
The cost is the gallons shown times the price.
How it works
For a fill-up the calculator changes the distance to miles and the fuel to gallons, and divides. It then gives the same mileage as liters per 100 kilometers and as kilometers per liter. Type the distance in miles or kilometers and the fuel in gallons or liters, in any mix.
A mile is 1.609344 kilometers and a gallon is 3.785411784 liters, both exact. Together they make the constant 235.2145833, which NIST rounds to 235.215 in its rule to divide that number by the miles per gallon. Type a price per gallon or liter to see the cost of the fuel and the cost of each mile or kilometer.
A worked example
312 miles on 12.4 gallons is 25.16 miles per gallon, which is 9.35 liters per 100 kilometers or 10.7 kilometers per liter. At $3.45 a gallon the fuel cost $42.78, which is $0.137 a mile. 500 kilometers on 40 liters is 8 liters per 100 kilometers, or 29.4 miles per gallon, and 12.5 kilometers per liter.
A trip of 450 miles at 28 miles per gallon takes 16.07 gallons. At $3.45 a gallon that costs $55.44, which is the gallons shown times the price. There and back, 900 miles take 32.14 gallons, which cost $110.88.
What it leaves out
The mileage of one fill-up is the mileage of that drive. It changes with how and where you drive, and the calculator does not model that. The second tool takes the miles per gallon that you give it.
Sources
- NIST Special Publication 811, Appendix B.9, Factors for units listed by kind of quantity, read on 2026-11-02.
- NIST Special Publication 811, Appendix B.8: factors for units listed alphabetically, read on 2026-11-01.
- NIST Handbook 44, Appendix C, General Tables of Units of Measurement (copy archived on 2009-01-09), read on 2026-11-02.
Questions
How do I calculate miles per gallon?
Divide the miles driven by the gallons that it took to fill the tank again. 312 miles on 12.4 gallons is 25.16 miles per gallon.
How do I change miles per gallon to liters per 100 kilometers?
Divide 235.215 by the miles per gallon, which is the rule of NIST. The exact constant is 235.2145833. 24 miles per gallon is 9.8 liters per 100 kilometers, and 25.16 is 9.35.
How do I change liters per 100 kilometers to miles per gallon?
Use the same constant the other way: divide 235.215 by the liters per 100 kilometers. 8 liters per 100 kilometers is 29.4 miles per gallon.
How much does a trip cost in fuel?
Divide the miles by the miles per gallon to get the gallons, and multiply by the price. 450 miles at 28 miles per gallon is 16.07 gallons, and at $3.45 a gallon that costs $55.44.
How many kilometers per liter is a mile per gallon?
One mile per gallon is 0.4251437 kilometer per liter. A mile is exactly 1.609344 kilometers and a gallon is 3.785411784 liters.
Published .