Distance Calculator

Between two points, in 3D space, or between two coordinates on Earth

Unit-agnostic. Enter metres and the answer is in metres, enter pixels and it is in pixels. Just keep both points in the same unit.

°
°
°
°

Use decimal degrees, negative for south and west, so London is 51.5074, −0.1278. This is straight-line distance over the ground, not the distance you would drive.

Distance

How to Use

  1. 1Pick the tab that matches your problem: flat coordinates, 3D space, or a place on Earth.
  2. 2Type both points. Coordinates update the answer as you type.
  3. 3Read the distance, then open the working to see the substituted formula.
  4. 4In lat/long mode every unit is listed at once, along with the bearing you would set off on.

The Formulas

  • 2D distanced = √(Δx² + Δy²)
  • 3D distanced = √(Δx² + Δy² + Δz²)
  • Haversinea = sin²(Δφ/2) + cos φ₁ cos φ₂ sin²(Δλ/2)
  • Great circled = 2R · asin(√a)
  • Earth radiusR = 6,371.0088 km

Quick Examples

Tap an example to load it above.

Guide

Everything about the Distance Calculator

One idea, the Pythagorean theorem, stretched from graph paper to the globe.

This distance calculator measures the straight-line distance between two points: on a flat plane, in three-dimensional space, or between two latitude and longitude coordinates on the surface of the Earth. Every answer shows its working.

The first two are exact. The third is an estimate, and the page says so plainly rather than presenting a spherical approximation as if it were surveying data.

The distance formula is Pythagoras in disguise. Draw a right triangle between your two points: the horizontal gap Δx is one leg, the vertical gap Δy is the other, and the distance you want is the hypotenuse. That is why d = √(Δx² + Δy²). Adding a third dimension just adds Δz² inside the square root. See the Pythagorean theorem calculator for the same idea with a diagram.

Worked example on a plane

From (1, 2) to (4, 6): Δx is 3, Δy is 4, so d = √(9 + 16) = √25 = 5. It is a 3-4-5 triangle, which is why the answer is a whole number. Most coordinate pairs are not so tidy.

Why Earth distances are harder

Latitude and longitude are angles, not lengths, so you cannot subtract them and apply Pythagoras. One degree of latitude is always about 111 km, but one degree of longitude shrinks from 111 km at the equator to zero at the poles. The haversine formula handles that by working on the sphere directly.

MethodEarth modelTypical error
Flat Pythagoras on lat/longNone (plain wrong)Huge at high latitude
Haversine (used here)SphereAbout 0.5%
Vincenty / KarneyEllipsoid (WGS-84)Under a millimetre

Half a percent is roughly 25 km on a London-to-Sydney flight and about 1.5 km on London to New York. That is fine for "how far apart are these two places" and wrong for navigation-grade work, so use a Vincenty or Karney implementation if you need metres.

Straight line, not driving distance

  1. 1Great-circle distance ignores roads

    It is the shortest path over the surface, what people call "as the crow flies". A real journey follows roads, coastlines and air corridors, so it is always longer, commonly by 20 to 40% by road.

  2. 2It ignores altitude too

    Both points are treated as sitting on the surface. Mountains, tunnels and cruising altitude do not change the figure.

  3. 3The bearing changes as you go

    The initial bearing shown is the heading at the start. Along a great circle it shifts continuously, which is why long-haul flight paths look curved on a flat map.

  4. 4Negative means south and west

    Decimal degrees have no N/S/E/W letters. Sydney is −33.8688 latitude because it is south of the equator; New York is −74.0060 longitude because it is west of Greenwich.

Which unit should you use?

Kilometres and miles for everyday distances. Nautical miles at sea and in aviation, where one nautical mile was originally one minute of latitude, which is why it is the natural unit for navigation, and it is now defined as exactly 1,852 metres. The calculator shows all of them at once so you never have to convert by hand.

FAQ

Frequently Asked Questions

What is the distance formula?

For two points on a plane it is d = √((x₂ − x₁)² + (y₂ − y₁)²). In three dimensions you add (z₂ − z₁)² inside the square root. It is the Pythagorean theorem applied to the horizontal and vertical gaps between the points, which become the two legs of a right triangle.

How do I calculate the distance between two latitude and longitude coordinates?

Switch to the latitude/longitude tab and enter both points in decimal degrees, using negative numbers for south and west. The calculator applies the haversine formula on a sphere of mean radius 6,371.0088 km and reports the result in kilometres, miles, metres, feet and nautical miles at once.

Why can I not just use the distance formula on latitude and longitude?

Because latitude and longitude are angles, not lengths. A degree of latitude is roughly 111 km everywhere, but a degree of longitude covers 111 km at the equator and shrinks to nothing at the poles. Treating them as flat coordinates gives answers that are badly wrong away from the equator, which is exactly what the haversine formula exists to fix.

How accurate is the haversine distance?

To about 0.5%, because it models the Earth as a perfect sphere when it is really an ellipsoid flattened at the poles. That is roughly 1.5 km on a London to New York route. For navigation-grade precision you need Vincenty's or Karney's method on the WGS-84 ellipsoid, which is accurate to under a millimetre.

Is this the driving distance between two places?

No. This is great-circle distance, the shortest path across the surface, what people call "as the crow flies". Any real route follows roads, coastlines or air corridors and is always longer, commonly 20 to 40% longer by road. Use a mapping service if you need road distance or travel time.

What does the initial bearing mean?

It is the compass heading, in degrees clockwise from true north, that you would set off on to follow the shortest path. Along a great circle the heading changes continuously, so it is the direction at the start rather than one you hold for the whole journey, which is why long flight paths look curved on a flat map.

Which units does the 2D and 3D mode use?

Whatever you use. Those modes are unit-agnostic. Enter metres and the distance is in metres, enter pixels and it is in pixels. The only rule is that both points must use the same unit. The unit conversion table appears in latitude/longitude mode, where the answer really is a physical distance.

Is the distance calculator free and is my data sent anywhere?

It is completely free with no sign-up, and every calculation runs inside your browser. No coordinate you type is transmitted or stored, so it is safe to use with private locations.