Calcist

Style

Buttons

Spacing

How much to show

Decimal places

Text size

Distance calculator

Find the straight-line distance and midpoint between two points on a graph or in 3D space, or how far apart two places on Earth are as the crow flies.

Distance between two points

Distance between two places (latitude and longitude)

Decimal degrees. North and east are positive; south and west are negative. The example is New York to Los Angeles.

Private: calculated on your device. Nothing you type is sent anywhere.

Next: Need the slope or equation of the line through the points? Use the slope calculator. Solving a whole triangle? Try the triangle calculator.

The distance formula

The distance between two points is the hypotenuse of a right triangle whose legs are the differences in x and y, so it comes straight from the Pythagorean theorem. In 3D, add the z difference too.

2D: d = √((x₂ − x₁)² + (y₂ − y₁)²)
3D: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²)
Midpoint: ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)

Example: from (1, 2) to (4, 6), Δx = 3 and Δy = 4, so d = √(9 + 16) = 5, and the midpoint is (2.5, 4). Add z₁ = 0 and z₂ = 12 and the 3D distance is √(9 + 16 + 144) = √169 = 13.

Distance on the Earth (haversine formula)

Places on a globe aren't on a flat grid, so the shortest path follows a great circle. With latitudes φ, longitudes λ in radians, and the Earth's mean radius R = 6,371 km:

a = sin²(Δφ ÷ 2) + cos φ₁ × cos φ₂ × sin²(Δλ ÷ 2)
d = 2R × atan2(√a, √(1 − a))

Example: New York (40.7128, −74.0060) to Los Angeles (34.0522, −118.2437) is about 3,936 km, or 2,446 miles.

How accurate is it?

  • The haversine formula treats the Earth as a perfect sphere. The real Earth bulges at the equator, so distances measured on the WGS84 ellipsoid differ by up to about 0.5%. For surveying, use an ellipsoidal method such as Vincenty's, like the NOAA tool below.
  • It's the distance as the crow flies. Driving distances follow roads and are longer, and flight paths bend around weather and airspace.
  • Height above sea level is ignored. For the 2D and 3D formulas, both points must use the same units.

Sources

How we checked this

Before every update, this calculator is run in a real browser with these known answers, and it must match all of them:

  • Antipodal points: any bearing ✓
  • (1, 2) to (4, 6): distance 5, midpoint (2.5, 4) ✓
  • 3D (1, 2, 0) to (4, 6, 12): distance 13 ✓
  • (0, 0) to (1, 1) is √2 ≈ 1.414213562 ✓
  • New York to Los Angeles ≈ 3,935.75 km (haversine, R = 6,371 km) ✓
  • London to Paris ≈ 213.48 miles ✓
  • Latitude 95 is rejected ✓

Last checked October 26, 2026. Spotted something wrong? The math is done in your browser with the formula shown on this page, so you can check any result by hand.

Add this calculator to your website (free)

Paste this code into any web page. The calculator works on your page, resizes itself, has no ads and no tracking, and nothing your visitors type is sent anywhere. More about embedding.

Questions people ask

How do I find the distance between two points?

Subtract the x values and the y values, square both differences, add them, and take the square root. From (1, 2) to (4, 6): √(3² + 4²) = 5.

How do I find the midpoint?

Average the coordinates: ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2). The midpoint of (1, 2) and (4, 6) is (2.5, 4).

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

Use the haversine formula above with the Earth's mean radius of 6,371 km. Enter both points in decimal degrees, with west and south as negative numbers.

Why is the great-circle distance different from Google Maps?

Map apps usually measure along roads, which is longer. Even for straight-line measures, some tools use an ellipsoid model of the Earth instead of a sphere, which changes the answer by up to about 0.5%.

How do I convert degrees, minutes and seconds to decimal degrees?

Decimal = degrees + minutes ÷ 60 + seconds ÷ 3,600. 40° 42′ 46″ N is 40 + 42/60 + 46/3600 ≈ 40.7128.

Related calculators