Distance Calculator

Measure the straight-line distance between two points on a plane, in 3D space, or between two latitude and longitude positions on the Earth.

Distance between two points (2D)

Enter the x and y coordinates of both points.

Distance between two points in 3D space

Distance between two places on Earth

Enter latitude and longitude as decimal degrees or as degrees, minutes and seconds. South and west are negative in decimal form.

The distance formula is Pythagoras in disguise

To measure the straight line between two points on a flat grid, treat the horizontal and vertical gaps as the two shorter sides of a right triangle. The distance is the long side: d = √((x₂ − x₁)² + (y₂ − y₁)²). For (1, 1) and (4, 5) the gaps are 3 and 4, so d = √(9 + 16) = √25 = 5, the classic 3-4-5 triangle. The order of the points does not matter, and the result is never negative. The 2D result also gives you the slope, angle and equation of the line joining the two points.

Adding the third dimension

In 3D you add one more squared gap: d = √(Δx² + Δy² + Δz²). That is useful for more than computer graphics. The longest straight object that fits in a room 4 m long, 3 m wide and 2.5 m high is the corner-to-corner diagonal, √(16 + 9 + 6.25) = √31.25, about 5.59 m. If you are working in 2D and want the angle between the points, the Slope Calculator gives it directly.

Distance between two places on Earth

Latitude and longitude points sit on a curved surface, so the flat formula does not work over any long distance. This calculator finds the shortest path along the Earth’s surface, the so-called great-circle or “as the crow flies” distance, using a model of the Earth as a slightly flattened sphere (an ellipsoid). Washington, D.C. to Philadelphia comes out at about 200 km (124 miles). It is always shorter than a road or flight route, which is why a driving trip between the same two places is longer. For road distances and travel time in the US, use the Mileage Calculator.

Entering coordinates correctly

In decimal form, north latitudes and east longitudes are positive and south latitudes and west longitudes are negative, so Washington, D.C. is about 38.9, −77.0. If your coordinates are written as degrees, minutes and seconds (38° 53′ 51″ N), switch to the second option and choose N or S and E or W instead of using minus signs. Latitude must be between −90 and 90 and longitude between −180 and 180.

Straight-line distance or taxicab distance?

The distance formula gives the straight-line, or Euclidean, distance. In a city laid out as a grid you cannot cut across blocks, so the distance you actually walk is the sum of the horizontal and vertical gaps. For (1, 1) and (4, 5) that is 3 + 4 = 7 blocks, against 5 in a straight line. If you need to turn a distance into a travel time, divide it by your speed, or let the Speed Calculator do it.

Related tools

If the distance you found is one side of a triangle, the Right Triangle Calculator finds the rest, and the Pythagorean Theorem Calculator handles the same formula when you already know two sides. For a triangle with no right angle, use the Triangle Calculator.

Earth-surface distances here are shortest-path, straight-over-the-surface figures. They ignore hills, roads, borders and the curve of any real route, so use them for planning and comparison, not for navigation.

Common questions

What is the distance formula?

d = √((x₂ − x₁)² + (y₂ − y₁)²). It comes from the Pythagorean theorem, with the horizontal and vertical gaps as the two shorter sides.

How do I find the distance between two coordinates on a map?

Use the latitude and longitude section. Enter each place in decimal degrees (south and west are negative) or in degrees, minutes and seconds, and the calculator gives the great-circle distance in kilometres and miles.

Why is the straight-line distance shorter than the driving distance?

Roads bend around obstacles and follow a network. The straight-line figure is the shortest possible path, so any road or flight route is at least as long.

How do I find the distance in 3D?

Add the squared difference of the z-values inside the square root: d = √(Δx² + Δy² + Δz²).

How accurate is the latitude and longitude distance?

It uses an ellipsoidal model of the Earth and is accurate to well under a percent for most pairs of points, which is far more accurate than simple spherical shortcuts.

More Math Calculators

Pick another tool to jump straight to it.