Distance Calculator

Find the distance between two points in 2D or 3D as an exact value such as 3√5, plus the Manhattan distance and midpoint. Or find the great-circle distance and bearing between two latitude and longitude coordinates.

Calculator Numbers & Math Updated Oct 3, 2026
How to Use
  1. Choose 2D, 3D or latitude/longitude.
  2. Type the coordinates of the two points. For places, use decimal degrees with minus for south and west, such as 40.7128, −74.0060.
  3. Read the distance: exact (like 3√5) and decimal for points, or kilometres, miles and nautical miles for places.
  4. The table adds the Manhattan and Chebyshev distances and the midpoint, or the bearing and midpoint for places.
  5. The drawing shows the right triangle behind the formula, the box diagonal in 3D, or the curved great-circle route on a world grid.
Input
Presets
Distance
Distance
—
Decimal
—
Manhattan
—
Midpoint
—

Worked Example

(−3, 1) to (3, 4). The gaps are Δx = 6 and Δy = 3. d = √(36 + 9) = √45. Since 45 = 9 × 5, √45 = 3√5 ≈ 6.708.

New York to London. With φ for latitude and λ for longitude in radians, the haversine formula gives a central angle of 50.1°, and 50.1° × π/180 × 6,371 km ≈ 5,570 km. The route leaves New York heading 51° (north-east).

The common mistake: adding before squaring. √(6 + 3)² is just 9. Square each gap first, then add: √(6² + 3²) = √45.

Show Work

Enter two points to see the step-by-step working.

Formulas

2D distance
√((x₂ − x₁)² + (y₂ − y₁)²)
3D distance
√(Δx² + Δy² + Δz²)
Manhattan
|Δx| + |Δy| (+ |Δz|)
Haversine
a = sin²(Δφ/2) + cos φ₁ cos φ₂ sin²(Δλ/2)
d = 2R atan2(√a, √(1 − a))
Initial bearing
θ = atan2(sin Δλ cos φ₂, cos φ₁ sin φ₂ − sin φ₁ cos φ₂ cos Δλ)

Measuring Across a Sphere

Eratosthenes estimated the Earth’s size around 240 BC from the angle of the Sun at two Egyptian cities, and spherical trigonometry for navigating across it was developed by Islamic astronomers in the 9th–11th centuries to find the direction of Mecca. The haversine (half of 1 − cos θ) got its own name and tables in the 19th century because it kept navigators’ logarithm calculations accurate for short distances.

The flat distance formula is younger in its familiar form: it needs coordinates, which arrived with Descartes and Fermat in the 1630s. Manhattan distance, named after the borough’s street grid, is from Hermann Minkowski’s geometry of the early 1900s.

About This Calculator

This calculator finds distances between points in 2D and 3D exactly, simplifying the square root, and also gives the Manhattan and Chebyshev distances and the midpoint. For places on Earth it uses the haversine formula on the mean Earth radius and gives kilometres, miles, nautical miles, the initial compass bearing and the midpoint of the route.

Everything runs in your browser; nothing is sent anywhere.

Related calculators: Slope Calculator, Pythagorean Theorem Calculator, and Map Measuring Tool.

Frequently Asked Questions

What is the distance formula?

d = √((x₂ − x₁)² + (y₂ − y₁)²), which is Pythagoras’ theorem applied to the horizontal and vertical gaps. From (1, 2) to (4, 6) the gaps are 3 and 4, so d = √(9 + 16) = √25 = 5. In 3D add (z₂ − z₁)² under the root.

What is Manhattan distance?

The distance travelling only along the axes, like a taxi on a city grid: |Δx| + |Δy|. From (1, 1) to (4, 5) it is 3 + 4 = 7 blocks, while the straight line is 5. Chebyshev distance is the larger of the gaps, 4 here: the number of moves a chess king needs.

How is distance between latitude and longitude calculated?

Along a great circle, the shortest path on a sphere, using the haversine formula: a = sin²(Δφ/2) + cos φ₁ cos φ₂ sin²(Δλ/2), then d = 2R · atan2(√a, √(1 − a)) with R = 6,371 km. New York to London comes out at about 5,570 km. The Earth is slightly flattened, so the exact ellipsoidal distance can differ by up to about 0.5%.

Why does the flight path curve on a map?

Flat maps stretch the globe, so the shortest route on the Earth, a great circle, looks curved on them. Flights from New York to London head north-east (about 51°) and arc up towards Newfoundland and Ireland rather than following the straight line drawn on a Mercator map.

How do I find the midpoint between two points?

Average each coordinate: ((x₁ + x₂)/2, (y₁ + y₂)/2). The midpoint of (1, 2) and (4, 6) is (2.5, 4). On the globe the midpoint of a great-circle route is found with vectors instead, because averaging latitudes and longitudes goes wrong near the poles and the date line.

How do I use the Distance Calculator?

Simply type your numbers and read the result, which refreshes the instant you change something. There is nothing to submit and nothing to wait for.

Do I need to install or sign up for anything?

Not at all — it runs in the browser with nothing to install and no account. After it loads once, it even works without an internet connection.

Is my information private?

Yes. Everything happens in your browser. Nothing you type is sent to a server or saved anywhere.

Common Use Cases

Homework

(−3, 1) to (3, 4): √45 = 3√5 ≈ 6.708.

Travel

New York to London: about 5,570 km, 3,461 mi or 3,008 nautical miles.

3D modelling

The diagonal of a 1 × 2 × 2 box is exactly 3.

City blocks

From (1, 1) to (4, 5) is 7 blocks by taxi, 5 as the crow flies.

Game design

Chebyshev distance counts king moves: 4 from (1, 1) to (4, 5).

Last updated: