Coordinate Distance Calculator Widget

Measure how far apart two places are as the crow flies. Enter two points in decimal degrees and get the great-circle distance in kilometres, miles and nautical miles, the compass bearing to set off on, and the midpoint of the route.

Travel & Auto Calculator Runs in your browser Free · no ads

Customize your widget

Theme
Auto follows the visitor's light/dark setting.
Style
Attribution on your page
Optional and entirely your choice. The exact line is shown in the code below; it links to the tool with rel="nofollow".
More options
Starting values
Leave blank to use the widget's defaults. Visitors can still change every value.

Live preview

Exactly what your visitors will see

Embed code

<iframe src="https://a2z.tools/embed/w/coordinate-distance-calculator" title="Coordinate Distance Calculator by A2Z Tools" width="100%" height="560" style="border:0;width:100%" loading="lazy" allow="clipboard-write"></iframe>

A plain iframe. Works everywhere, including site builders that strip scripts. Adjust height if your content needs more room.

Works with

How it works

The haversine formula gives the angle between the two points as seen from the Earth's centre, and is numerically stable even for points a few metres apart. Multiplying by a radius turns the angle into a distance; the widget uses 6,371.0088 km, the mean radius (2a + b) / 3 of the GRS 80 ellipsoid recommended by the IUGG, from an equatorial radius of 6,378.137 km and a polar radius of 6,356.752 km. Miles use 1.609344 km and nautical miles 1.852 km. The initial bearing is the true-north direction to leave point A on the great circle; it changes along the way except on meridians and the equator. The midpoint is the point halfway along the arc. Treating the Earth as a sphere is the main approximation: ellipsoidal methods such as Vincenty's can differ by up to about 0.5%. JFK airport (40.6413, -73.7781) to London Heathrow (51.47, -0.4543) comes out at 5,540 km, starting on a bearing of 51.4 degrees.

Calculation method

  • a = sin²(dlat / 2) + cos lat1 x cos lat2 x sin²(dlon / 2)
  • Distance = 2 R atan2(sqrt a, sqrt(1 - a)), R = 6,371.0088 km
  • Initial bearing = atan2(sin dlon x cos lat2, cos lat1 x sin lat2 - sin lat1 x cos lat2 x cos dlon)
  • Midpoint from the spherical average of the two unit vectors
  • 1 mi = 1.609344 km; 1 nmi = 1.852 km

Worked examples

New York JFK to London Heathrow

Inputs: 40.6413, -73.7781 to 51.47, -0.4543

Result: 5,540 km (3,442.4 mi, 2,991.4 nmi); initial bearing 51.4° (NE); midpoint 52.2167, -41.3027

The midpoint lies north of both airports, over the Atlantic.

A quarter of the way round

Inputs: 0, 0 to 0, 90

Result: 10,007.6 km (6,218.4 mi); bearing 90° (E); midpoint 0, 45

pi / 2 x 6,371.0088 km.

Limitations

  • Spherical model: up to about 0.5% different from an ellipsoidal geodesic.
  • Straight-line distance only, not a road, rail or flight-plan distance.
  • Inputs are decimal degrees; convert other formats with the coordinates converter first.

Where publishers use it

  • An aviation enthusiast blog comparing flight routes
  • A sailing or yacht delivery page estimating passage length
  • A geography class exercise on great circles
  • A drone or radio hobby site checking line-of-sight range
  • A logistics article explaining why flight paths curve on flat maps

Questions

Why does the route look curved on a map?

The shortest path on a sphere is a great circle. On the usual Mercator map it bows towards the pole, which is why flights from New York to London head north-east over Newfoundland rather than due east.

How accurate is the haversine formula?

On a sphere it is exact. The Earth is slightly flattened, so real geodesic distances differ by up to about 0.5% depending on the route's direction and latitude. For surveying or legal boundaries use an ellipsoidal method such as Vincenty's.

Which Earth radius is used?

6,371.0088 km, the mean radius of the GRS 80 / WGS 84 ellipsoid: (2 x 6,378.137 + 6,356.752) / 3. Some calculators use 6,371 or 6,378 km; the latter gives distances about 0.1% longer.

Why doesn't the bearing match the bearing back?

On a great circle the direction changes along the way, so the bearing from B back to A is not simply the forward bearing plus 180 degrees, except on the equator or a meridian.

What about two points on opposite sides of the Earth?

Exactly antipodal points are 20,015.1 km apart, but every great circle through them is equally short, so the widget reports any direction for the bearing and no unique midpoint.

Sources

  1. Earth Fact Sheet - NASA Goddard Space Flight Center . Equatorial radius 6,378.137 km and polar radius 6,356.752 km, from which the mean radius (2a + b) / 3 = 6,371.0088 km follows. Checked 2026-10-01.
  2. Direct and Inverse Solutions of Geodesics on the Ellipsoid with Application of Nested Equations (T. Vincenty, Survey Review, 1975) - NOAA National Geodetic Survey . The ellipsoidal inverse method referred to for higher-accuracy distances. Checked 2026-10-01.

Cite or recommend this tool

If you reference this tool in an article, course or documentation, these formats are ready to copy. They are optional - nothing is added to your site unless you paste it.

A2Z Tools Coordinate Distance Calculator
https://a2z.tools/distance-between-two-latitude-longitude
  • Coordinates Converter

    Travel & Auto Converter New

    Latitude and longitude between decimal degrees, degrees-minutes-seconds and decimal minutes.

    Get code
  • Speed, Distance & Time Calculator

    Travel & Auto Calculator

    Solve speed, distance or time from the other two, in km, miles, metres or nautical miles.

    Get code
  • Travel Budget Calculator

    Travel & Auto Calculator

    Trip total, per person and per day from stay, food, transport, activities, flights and a buffer.

    Get code
  • Fuel Cost Calculator

    Travel & Auto Calculator

    Fuel needed and trip cost from distance, economy and fuel price, split between passengers.

    Get code
  • Fuel Economy Converter

    Travel & Auto Converter

    Convert between MPG (US), MPG (UK), L/100 km and km per litre with exact factors.

    Get code
  • Car Loan Calculator

    Travel & Auto Calculator

    Monthly car payment with down payment, trade-in, sales tax and fees, plus the total cost.

    Get code

Preview