Calculate trip fuel cost from distance, efficiency and fuel price
This trip fuel cost calculator estimates how much fuel a journey requires and what that fuel will cost.
Run — free
Enter the trip distance, the vehicle's efficiency as distance per unit of fuel, and the price of one fuel unit. Keep the units consistent: miles pair naturally with miles per gallon, while kilometers can pair with kilometers per liter. The result gives both estimated fuel consumption and total fuel cost, making it useful for planning, comparison, reimbursement, and budgeting before travel begins.
Enter compatible distance and efficiency values
Start with the total distance you expect to travel, including every leg that belongs in the estimate. Then enter fuel efficiency in a distance-per-fuel-unit format. Common combinations include miles with miles per gallon and kilometers with kilometers per liter. The calculator does not attach a particular measurement system to the numbers, so consistency is what matters. If the distance is entered in miles, the efficiency must describe miles per chosen fuel unit; if the distance is in kilometers, efficiency must describe kilometers per that same fuel unit. A zero-distance trip is valid and produces zero fuel use and zero cost. Fuel efficiency, however, must be greater than zero because division by zero or a negative efficiency has no meaningful interpretation here. For a round trip, either enter the complete round-trip distance or double the one-way distance before calculating. When using a dashboard efficiency reading, consider whether it reflects recent driving conditions closely enough for the journey you are planning. A long-term average often gives a steadier planning estimate than a reading from one unusually short drive.
Understand how fuel use and cost are calculated
The calculation has two direct steps. First, trip distance is divided by fuel efficiency to estimate the amount of fuel required. Second, that fuel amount is multiplied by the price per fuel unit to estimate the trip's fuel cost. For example, when efficiency is stated in miles per gallon, dividing miles by miles per gallon produces gallons. Multiplying those gallons by a price per gallon produces a cost in the currency used for the price. The same dimensional logic works for kilometers per liter and a price per liter. Results are rounded to a stable precision so they remain convenient for software and repeatable in automated workflows, but the estimate should not be mistaken for a receipt. Actual consumption can differ because of speed, traffic, weather, elevation, tire pressure, vehicle load, idling, detours, and driving style. Likewise, the price at the pump may differ from the planning value. Use the result as a clear baseline, then add a reasonable buffer when the route or conditions are uncertain. The method remains transparent enough to audit with a calculator or spreadsheet.
Use the estimate for budgets and comparisons
A fuel-cost estimate becomes more useful when every scenario uses the same assumptions. To compare two vehicles, keep distance and fuel price fixed while changing only fuel efficiency. To compare two routes, keep vehicle efficiency and fuel price fixed while changing distance. To test the effect of price changes, hold the route and efficiency constant and enter a different price per fuel unit. This disciplined approach prevents several changing inputs from hiding the reason one estimate is higher. The result can support a personal travel budget, a delivery quote, an employee reimbursement preview, or a shared-trip discussion, although any formal reimbursement policy may require an approved mileage rate instead of actual fuel cost. Record the inputs with the result when reproducibility matters, because an isolated total does not reveal which distance, efficiency, or price produced it. The API price is $0.002 per request, while the browser version can be used directly on the page. Neither path calls external services, so the output depends only on the three values supplied. Recalculate whenever the route, expected vehicle, or likely fuel price changes materially.
What you can do with it
Plan a road-trip budget
Estimate the fuel portion of a vacation or weekend journey before committing to the route.
Compare vehicles for one route
Keep distance and price fixed to see how different fuel-efficiency values change expected cost.
Preview delivery expenses
Use route distance, fleet efficiency, and a current planning price to estimate fuel expense per trip.
FAQ
What formula does the calculator use?
It divides distance by fuel efficiency to estimate fuel used, then multiplies fuel used by the price per fuel unit.
Which distance and fuel units can I use?
Any consistent distance-per-fuel-unit combination works, such as miles with miles per gallon or kilometers with kilometers per liter.
Can I enter liters per 100 kilometers?
No. Fuel efficiency must be entered as distance per unit of fuel. Convert liters per 100 kilometers to kilometers per liter first.
Why must fuel efficiency be positive?
Fuel use is calculated by dividing distance by efficiency. Zero would require division by zero, and a negative efficiency is not meaningful for this estimate.
Does the estimate include tolls or other travel expenses?
No. It estimates fuel use and fuel cost only; tolls, parking, maintenance, lodging, and other expenses are excluded.
What does the API request cost?
The API price is $0.002 per request. The same deterministic calculation is also available in the browser.
For developers — API access
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.
API endpoint
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.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/calc2/fuel-cost-trip \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"distance":420,"fuel_efficiency":35,"fuel_price":3.75}'const res = await fetch("https://api.kit.forhosting.com/calc2/fuel-cost-trip", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"distance": 420,
"fuel_efficiency": 35,
"fuel_price": 3.75
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/calc2/fuel-cost-trip",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"distance": 420,
"fuel_efficiency": 35,
"fuel_price": 3.75
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/calc2/fuel-cost-trip", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"distance":420,"fuel_efficiency":35,"fuel_price":3.75}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"distance":420,"fuel_efficiency":35,"fuel_price":3.75}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/calc2/fuel-cost-trip", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"distance": 420,
"fuel_efficiency": 35,
"fuel_price": 3.75
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "calc2.fuel_cost_trip",
"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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |