Distance between coordinates: km, miles, bearing and midpoint

$0.01 per call · failed calls are never charged · no account or API key needed

Great-circle distance between two latitude/longitude points (haversine on the mean earth radius) in kilometres, miles and nautical miles, plus the initial compass bearing and the midpoint. Accurate to about 0.5% against the ellipsoid. Use for delivery radius, travel and proximity checks, or sorting places by distance; for coordinates of a place name use geocode first.

Run it free (25 free calls) Buy credits by card (from $5) Example result (JSON)

Try it with your own inputs

Latitude of the first point (-90 to 90)
Longitude of the first point (-180 to 180)
Latitude of the second point
Longitude of the second point

Uses one of your 25 free calls. Nothing is charged, and a call that fails is not counted.

Inputs

NameTypeDescription
lat1 (required)numberLatitude of the first point (-90 to 90)
lon1 (required)numberLongitude of the first point (-180 to 180)
lat2 (required)numberLatitude of the second point
lon2 (required)numberLongitude of the second point

Request

Over HTTP, with a card key from /credits:

curl -H "Authorization: Bearer adt_…" "https://agent-data-tools.revmesh2074.workers.dev/geo/distance?lat1=59.3293&lon1=18.0686&lat2=51.5072&lon2=-0.1276"

Or one of your 25 free calls, no key:

curl "https://agent-data-tools.revmesh2074.workers.dev/geo/distance?lat1=59.3293&lon1=18.0686&lat2=51.5072&lon2=-0.1276&trial=1"

Without a key, the same URL answers 402 Payment Required with x402 and MPP terms, so an agent with a wallet pays per call in USDC (Base, Polygon, Arbitrum or Solana over x402; Base or Tempo over MPP) and retries.

Example result

{
  "km": 1432.79,
  "miles": 890.29,
  "nauticalMiles": 773.64,
  "bearing": 240.6,
  "compass": "WSW",
  "midpoint": {
    "lat": 55.7531,
    "lon": 8.0606
  }
}

From an AI agent (MCP)

Add the MCP server to Claude, Cursor or any MCP client. This tool is geo_distance, and the first 25 successful calls are free:

https://agent-data-tools.revmesh2074.workers.dev/mcp

Related tools