DevTools Surf logoDevTools Surf
AI / Modern DevAnimation / CSSAPI / Config
Sign in
DevTools Surf logoDevTools Surf
AI / Modern DevAnimation / CSSAPI / Config
Sign in
HomeTravelTravel Distance Calculator

Example: Travel Distance Calculator

A worked example, rendered from real sample data. Sign in to run the tool on your own input.

Input
from=NYC
to=LA
transport=car
mpg=32
fuel_price=3.45
Output
═══ What this tool computed ═══
ℹ Great-circle (haversine) distance between two sets of coordinates. This page runs offline and makes no outbound network calls. — no mapping or routing service was queried.
ℹ A real road or rail route is always longer than the great circle. The route estimate below multiplies by a fixed factor that is stated in full.

═══ Points ═══
From: New York, US
  40.71, -74.01 — from the built-in table
To: Los Angeles, US
  34.05, -118.24 — from the built-in table
ℹ Table coordinates are the city or airport centre to two decimal places, so they are accurate to about 1 km.

═══ Straight-line distance ═══
Kilometres: 3935.2
Miles: 2445.2
Nautical miles: 2124.9
Initial bearing: 273.7° (W)
Midpoint: 39.5070, -97.1599
Angular separation: 35.39° of arc

═══ Route estimate by car ═══
Detour factor applied: x1.25 (stated assumption, not a measured route)
Estimated travel distance: 4919 km / 3057 mi
Assumed average speed: 90 km/h — motorway average including stops
Estimated time: 54h 39m
⚠ 54.7 hours of driving is more than one legal shift in most countries — plan an overnight stop.

═══ Fuel and cost ═══
Consumption you gave: 32 mpg
Fuel price you gave: 3.45 per gallon
Fuel needed: 95.5 gallons
Fuel cost: 329.53

═══ Get the real routed distance ═══
  https://www.google.com/maps/dir/40.71,-74.01/34.05,-118.24
  https://www.openstreetmap.org/directions?from=40.71%2C-74.01&to=34.05%2C-118.24
  curl -s 'https://router.project-osrm.org/route/v1/driving/-74.01,40.71;-118.24,34.05?overview=false' | jq '.routes[0].distance, .routes[0].duration'
ℹ Those follow real r
…

About Travel Distance Calculator

Travel Distance Calculator preview - Travel tool

Great-circle distance, bearing and midpoint between cities, airport codes or raw coordinates, plus a route and time estimate with stated assumptions. Part of the DevTools Surf developer suite. Browse more tools in the Travel collection.

Use Cases

  • Calculate driving time and distance between cities for road trip planning.
  • Compare multiple routes between two destinations by total distance and estimated driving time.
  • Estimate fuel cost for a trip using distance and vehicle fuel economy.
  • Calculate commute distance when evaluating a potential new home location.

Tips

  • Calculate driving distance separately from straight-line (as-the-crow-flies) distance — driving distances are typically 20–40% longer than straight-line for most routes.
  • Account for border crossing wait times on international drives — they can add 1–4 hours to cross-border routes at busy crossings.
  • For multi-stop trips, use the nearest-neighbor algorithm to find a reasonably efficient route order before optimizing further.

Fun Facts

  • The driving distance from New York to Los Angeles (2,790 miles via I-40) would take approximately 41 hours of non-stop driving at highway speeds — but the same distance in a straight line is only 2,451 miles.
  • The longest drivable distance within a single country is the Trans-Canada Highway from Victoria, BC to St. John's, NL at 7,821 km (4,860 miles).
  • Google Maps launched its driving directions feature in 2007, three years after the service launched with maps-only navigation. It now processes over 1 billion kilometers of driving directions per day globally.

FAQ

How is driving time estimated?
Driving time = distance / average speed. Highway average including stops is typically 60–65 mph in the US. Add 15–20% for urban segments, mountain terrain, and border crossings. Real-world time is typically 10–15% over pure driving time estimates.
What is haversine distance vs. driving distance?
Haversine calculates the great-circle distance between two GPS coordinates (the shortest path on the Earth's surface). Driving distance follows road networks and is always longer. For most continental routes, driving distance is 15–40% longer than haversine.

Related Travel Tools

Travel Itinerary PlannerFlight Cost ModelHotel Cost EstimatorTravel Budget PlannerPacking List GeneratorCurrency Exchange CalculatorVisa Requirement CheckerTravel Insurance Calculator
New · Flagshipsimple REST client

REST Handler — Collections, env vars, history, cURL converter

Send requests, save collections (nested), swap environments, and convert between cURL / Collection JSON / REST Handler YAML.

Open

Popular tools

The most-used tools on DevToolsSurf, one click away.

Encoding & crypto

  • Base64 Encode
  • Base64 Decode
  • URL Encoder
  • URL Decoder
  • Hash Generator
  • JWT Decoder
  • JWT Encoder
  • UUID Generator
  • ULID Generator
  • Password Generator
  • Bcrypt Hash Tester

Converters

  • CSV to JSON
  • JSON to CSV
  • XML to JSON
  • JSON to XML
  • HTML → Markdown
  • HTML → React JSX
  • cURL to Code
  • Collection JSON → cURL
  • Swagger to Collection JSON
  • JSON → Go Struct
  • JSON → TypeScript Types

JSON & YAML

  • JSON Formatter
  • JSON Validator
  • JSON Viewer
  • JSON Minifier
  • JSON Diff
  • JSONPath Tester
  • YAML Formatter
  • YAML to JSON
  • JSON to YAML

Text & regex

  • Regex Tester
  • Text Diff
  • Case Converter
  • Word Counter
  • Markdown Preview
  • Slug Generator
  • Lorem Ipsum Generator
  • Markdown → PDF

CSS & color

  • CSS Beautifier
  • Minify CSS
  • Color Converter
  • Gradient Generator
  • Contrast Checker
  • Color Palette Generator
  • Flexbox Playground
  • Tailwind → CSS

Generators

  • QR Code Generator
  • Mock Data Generator
  • Favicon Generator
  • .gitignore Builder
  • README.md Generator
  • Dockerfile Generator
  • Sitemap Generator

API & networking

  • REST Handler
  • HTTP Header Analyzer
  • IP Address Lookup
  • CIDR Calculator
  • User-Agent Parser
  • HTTP Status Reference
  • OpenAPI Viewer

Date & time

  • Timestamp Converter
  • Timezone Converter
  • Cron Expression Parser
  • Duration Calculator
  • Age Calculator
  • Date Format Converter

Images

  • Image Converter
  • Image Resizer (Batch)
  • SVG Optimizer
  • Base64 ↔ Image
  • WebP ↔ AVIF Converter
  • Image Compressor

PDF tools

  • PDF Merger
  • PDF Splitter
  • PDF Compressor
  • Markdown → PDF
  • EPUB → PDF
  • MOBI / AZW → PDF
  • DOCX → PDF
  • HTML → PDF

Resources

  • Community feed
  • Themes marketplace
  • Pricing & credits
  • Privacy policy
  • Terms of service
  • Sitemap
  • robots.txt

Your account

  • Sign in
  • Dashboard
  • Run history
  • My profile
  • Settings
DevTools Surf logo
DevTools Surf919+ tools

Fast · privacy-first · client-side · © 2026

Home·Feed·ThemesPricing·Sign inPrivacy·Sitemap Feedback