Distance Between Two Coordinates Calculator (Latitude and Longitude)
Need the straight-line distance between two GPS points for a drone mission, a boat route or a GNSS project? Enter the latitude and longitude of both points, or simply click them on the map, and the calculator below returns the great-circle distance in kilometres, statute miles, nautical miles and metres.
In this article 7
Point 1 (A)
Point 2 (B)
You can also pick points by clicking the map. The first click sets point A, the second sets point B.
Kilometres
—
Miles (statute)
—
Nautical miles
—
Metres
—
How the distance is calculated: the haversine formula
The Earth is (almost) a sphere, so the shortest path between two points on its surface is an arc of a great circle, not a straight line on a flat map. The calculator uses the haversine formula, the standard way to compute this distance from latitude and longitude:
a = sin²(Δφ/2) + cos φ1 · cos φ2 · sin²(Δλ/2)
c = 2 · atan2(√a, √(1−a))
d = R · c
φ = latitude, λ = longitude (in radians)
R = 6,371 km (mean Earth radius)Example: London (51.5074, −0.1278) to Paris (48.8566, 2.3522) → about 343.6 km, 213.5 miles or 185.5 nautical miles.
How accurate is it?
Haversine treats the Earth as a perfect sphere with a mean radius of 6,371 km. The real Earth is slightly flattened at the poles, so the result can differ from the precise ellipsoidal distance by up to about 0.5%. For drone missions, boat routes and most hobby projects this is more than accurate enough. For surveying-grade results, use an ellipsoidal method such as Vincenty’s formulae or Karney’s algorithm on the WGS84 ellipsoid.
Keep in mind that this is the distance “as the crow flies”. Road distance, sailing routes around land and flight paths around restricted areas will always be longer.
Units: kilometres, miles and nautical miles
| Unit | Equals | Typical use |
|---|---|---|
| Kilometre (km) | 1,000 m | Most of the world, maps |
| Statute mile (mi) | 1,609.344 m | US and UK road distances |
| Nautical mile (nm) | 1,852 m | Marine and aviation navigation |
One nautical mile corresponds to one minute of latitude, which is why it is the standard unit at sea and in the air. Speed in knots is simply nautical miles per hour.
Coordinate formats
The calculator expects coordinates in decimal degrees (DD), for example 51.5074. North and east are positive, south and west are negative. If your coordinates are in degrees-minutes-seconds (51° 30′ 26.6″ N), convert them first with the coordinate converter (DD ↔ DMS). GPS receivers output positions in NMEA sentences; you can decode them with the NMEA 0183 decoder.
Practical uses
- Drone and FPV range checks: How far was your furthest point from home?
- Mission planning: Distances between waypoints for ArduPilot or INAV missions.
- Marine navigation: Distance to a buoy, harbour or waypoint in nautical miles.
- GNSS testing: Compare two receivers, or measure drift between fixes.
- Telemetry and logging: Compute distance travelled from logged GPS points.
To find the compass direction from one point to the other, use the bearing calculator.
Frequently asked questions
Why is the result different from my map app?
Map apps usually show road or route distance. This calculator shows the shortest great-circle distance over the Earth’s surface, which is always shorter.
Can I use this in my own code?
Yes. The haversine formula above can be implemented in a few lines on an Arduino, ESP32 or in Python. Use double precision where possible, because small angle differences matter over short distances.
Does altitude affect the distance?
Haversine ignores altitude. For two points at very different heights over a short distance, combine the horizontal distance with the height difference using Pythagoras to get the 3D distance.
How precise does my GPS need to be?
A standard GPS receiver is accurate to a few metres, so distances under about 10 m are dominated by GPS error. For centimetre-level positioning, see our guide to RTK GPS.







