ForHosting KIT · Travel & geography

Fuel cost calculator

Enter 100 km, a car that uses 8 L/100 km and fuel at 1.50 per liter: the trip needs 8 liters and costs 12.00. Useful for holiday drives, delivery routes or comparing two cars before you choose. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Distance (km)
100
Fuel consumption
8
Price per liter
1.50
You get
Distance (km)
100.00
Fuel consumption
8.00
Liters
8.000
Total cost
12.00

Plan a road trip or a delivery route by combining distance in kilometers, fuel use in liters per 100 km and the price per liter.

From a consumption rating to liters and cost

Most cars are rated in liters per 100 km, the amount of fuel burned over that distance. To get the fuel for a trip, the calculator multiplies the distance by that rating, divides by one hundred and rounds to a thousandth of a liter. The total cost is those liters times the price per liter, rounded to the nearest cent. A 100 km drive at 8 L/100 km with fuel at 1.50 per liter therefore needs 8 liters and costs 12.00. The arithmetic is exact, so long routes do not drift.

Getting a realistic trip budget

Use the average consumption you actually get and the local price where you will fill up. Fleet managers can price each delivery route the same way, and anyone choosing between two cars can compare their ratings on the same distance and price. The most common slip is entering a different kind of rating, such as kilometers per liter: this calculator expects liters per 100 km, and mixing the two gives an answer that is far off.

Liters from distance and consumption

Fuel used equals distance times consumption divided by one hundred, rounded half-up to one thousandth of a liter. That matches the common L/100 km rating on cars while avoiding floating-point drift on long routes.

Road trip budgeting

Estimate fuel spend before a holiday drive.

Fleet and delivery

Rough cost per route from average consumption and local fuel price.

Compare cars

Contrast two L/100 km ratings on the same distance and price.

Which units are used?

Kilometers, liters per 100 km and price per liter (metric v1).

How is rounding done?

Half-up on milliliters and on money cents with integer arithmetic.

How are the liters for a trip calculated?

The distance is multiplied by the consumption figure and divided by one hundred, because the rating is given per 100 km. The result is rounded to a thousandth of a liter, with halves going up.

How do I compare the fuel cost of two cars?

Run the calculation twice with the same distance and fuel price, changing only the L/100 km rating of each car. The gap between the two totals is what the thirstier car costs you on that trip.

Can I enter decimals for the distance or the fuel price?

Yes, with up to two decimal places, for distance, consumption and price alike. Negative values are not accepted, since neither a trip nor a fuel price can go below zero.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/dev/fuel-cost

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/dev/fuel-cost \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"distance_km":"100","consumption":"8","price_per_liter":"1.50"}'
{
  "distance_km": "100",
  "consumption": "8",
  "price_per_liter": "1.50"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "dev.fuel_cost",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_scaled999999999999999
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

This calculator uses only integer math with half-up rounding so liters and total cost stay stable across browser and API.

Canonical inputs without floats

Distance, consumption and price accept non-negative integers or digit strings with at most two decimals. Internally every value is scaled by one hundred before any multiplication. Leading zeros, plus signs, JSON floats and booleans are rejected.

Total cost half-up to the cent

Total cost multiplies the computed liters by the price per liter and rounds half-up to the nearest cent. Outputs echo normalized distance, consumption and price as two-decimal strings, liters with three decimals, and total_cost with two.

Automated checks

Assert liters and total_cost in CI fixtures.

Can I pass floating-point JSON numbers?

No. Use strings or whole integers.

What if distance is zero?

Liters and total cost are zero.

Are negative values allowed?

No. They return invalid_input.

Is it free in the browser?

Yes. The native app uses the API at $0.002.

Read the full KIT documentation →