Multi-stop route total distance
New York–Philadelphia 120 km, Washington 140 km and Richmond 110 km add up to 370 km, with running totals of 120, 260 and 370 km. Enter your leg distances to get the route total and the mileage at every stop. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Origin
- New York
- Total
- 370 km
- Total km
- 370
- Total mi
- 229.907341
- Leg count
- 3
Planning a multi-city road trip, a delivery tour, or a multi-hotel itinerary usually starts with a list of leg distances you already trust — from a map app, a printed guide, or a dispatcher sheet. What you still need is a clean total and a cumulative mileage reading at every stop so fuel stops, break points, and cost splits stay honest. This multi-stop route total distance calculator accepts an ordered list of leg distances, optionally labeled with destination names, sums them into one route total, and builds a cumulative odometer-style table from the origin through the final waypoint.
How multi-stop itinerary distance and cumulative mileage work
A multi-stop route here is an ordered open itinerary made of one or more legs. Each leg is a non-negative distance you already measured or estimated between consecutive stops — city to city, depot to customer, hotel to hotel. The capability does not look up coordinates and does not invent road paths; it treats your distances as the source of truth and focuses on bookkeeping that planners actually reuse.
With n legs there are n plus one stops: stop zero is the origin with cumulative mileage zero, and after each completed leg the running sum advances by that leg’s distance. The total route distance is simply the sum of all legs. That identity is the same odometer logic drivers use when they write mileposts in a trip log: start at zero, add each segment, and the reading at the last stop equals the trip total.
Optional labels on each leg name the destination of that segment; an optional origin string names the first stop so the cumulative table is readable in a UI without a second join. Zero-length legs are allowed (a same-site stop or a placeholder), but negative distances are rejected because mileage cannot go backwards in this model.
Where multi-stop route totals fit in products and pipelines
Pair with fuel volume or trip cost tools when you next need expense estimates; pair with average speed or ETA tools when you next need time. Do not use this for great-circle distance from latitude and longitude — that is a different search intent served by geographic polyline tools that measure haversine legs. Here the user already owns the distances and wants itinerary totals and cumulative mileage only.
Failed validation does not consume balance. Keep lists modest for interactive UX, pin rounded totals in tests, and you get a small, auditable building block for every channel that KIT already serves.
What you can do with it
Road-trip itinerary tables
Paste city-to-city leg distances, label each stop, and publish total distance plus cumulative mileage at every hotel night.
Multi-stop delivery progress
Sum depot-to-stop and stop-to-stop lengths and show drivers how many miles remain after each completed leg.
Trip cost and fuel pre-steps
Compute a single total distance from known legs before calling fuel volume, fuel cost, or trip budget calculators.
FAQ
How is multi-stop route total distance calculated?
Each leg distance is validated as a finite non-negative number, then summed. Cumulative mileage at stop k is the sum of the first k legs; the origin starts at zero.
Do I need GPS coordinates or addresses?
No. Supply leg distances you already have (from maps, manifests, or estimates). This tool does not geocode or measure great-circle paths from lat/lon.
What is the minimum number of legs?
At least one leg is required (two stops: origin and destination).
Can I mix kilometres and miles in one request?
No. All leg distances must share the same unit, selected with unit km or mi.
Can I name each stop?
Yes. Each leg can carry the name of the place it ends at, and you can name the starting point too. The names only label the cumulative table; they never change the distances or the total.
Related tools
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/travel/multi-stop-route-distance \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"legs":[{"distance":120,"label":"Philadelphia"},{"distance":140,"label":"Washington DC"},{"distance":110,"label":"Richmond"}]}'const res = await fetch("https://api.kit.forhosting.com/travel/multi-stop-route-distance", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"legs": [
{
"distance": 120,
"label": "Philadelphia"
},
{
"distance": 140,
"label": "Washington DC"
},
{
"distance": 110,
"label": "Richmond"
}
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/travel/multi-stop-route-distance",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"legs": [
{
"distance": 120,
"label": "Philadelphia"
},
{
"distance": 140,
"label": "Washington DC"
},
{
"distance": 110,
"label": "Richmond"
}
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/travel/multi-stop-route-distance", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"legs":[{"distance":120,"label":"Philadelphia"},{"distance":140,"label":"Washington DC"},{"distance":110,"label":"Richmond"}]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"legs":[{"distance":120,"label":"Philadelphia"},{"distance":140,"label":"Washington DC"},{"distance":110,"label":"Richmond"}]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/travel/multi-stop-route-distance", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"legs": [
{
"distance": 120,
"label": "Philadelphia"
},
{
"distance": 140,
"label": "Washington DC"
},
{
"distance": 110,
"label": "Richmond"
}
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "travel.multi_stop_route_distance",
"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. |
Technical notes
Choose kilometres or statute miles; every successful response also returns both total_km and total_mi.
How multi-stop itinerary distance and cumulative mileage work
When unit is kilometres, total and total_km match and total_mi is derived with the international factor of 1.609344 kilometres per statute mile; when unit is miles the dual conversion runs the other way.
Input contract, units, aliases, and validation errors
Each entry may be an object with a required distance field and an optional label string, or a plain finite number treated as a distance without a label. Empty legs, more than five hundred entries, or an unknown unit fail validation before any sum runs and are not billed. Swapping unit without converting the numbers is a common client bug — if your sheet is in miles, send unit mi rather than leaving the default. POST a JSON body with a required legs array of at least one entry. Distance values must be finite and non-negative; empty strings, NaN, Infinity, and missing distance fields fail with invalid_input naming the row. The array accepts transport aliases segments, stages, and distances so mobile and spreadsheet clients can map columns without a reshape step. Optional unit selects the input and primary total unit: km (default) or mi; aliases include distance_unit. Optional origin (aliases start, start_label, origin_label) only labels stop zero and never changes the math. A successful payload returns total and unit; always-present total_km and total_mi; leg_count and stop_count; legs as an ordered list of leg index, distance, cumulative mileage after that leg, and optional label; cumulative_at_stops as stop index, cumulative mileage, and optional label from origin through the final waypoint; plus formula and method strings for audit and docs. Pricing is a flat $0.002 per successful item on the API; the in-browser tier-A path is free for interactive checks.
Where multi-stop route totals fit in products and pipelines
Use this endpoint whenever leg distances already exist and you need a transparent total plus per-stop cumulative mileage: road-trip planners that paste city-to-city lengths from a map export, multi-stop delivery sketches before fuel and cost modules, travel blogs that publish an itinerary table with running distance, fleet dashboards that enrich a stop list with odometer-style progress, and classroom logistics exercises that teach prefix sums on real trip data. Call it from a Worker, a backend job, or a script: pass legs, read total and cumulative_at_stops, optionally store the legs breakdown next to each UI row.
Technical questions
How much does the API cost?
Each successful request is priced at $0.002 from your prepaid ForHosting KIT balance. Failed validation is not charged. The browser tool is free.