Skip to content
ToolPaxaAll Tools for Everyone, in One Place.All calculators

Distance Calculator

Find straight-line distance in 1D, 2D and 3D, or the shortest surface distance between two points on Earth.

Formula reference

d=√[(x₂−x₁)²+(y₂−y₁)²]

All formulas
  • d=|x₂−x₁|
  • d=√[(x₂−x₁)²+(y₂−y₁)²]
  • d=√[(x₂−x₁)²+(y₂−y₁)²+(z₂−z₁)²]
  • d=geodesic((φ₁,λ₁),(φ₂,λ₂))
  • DD=sign × (D+M/60+S/3600); d=geodesic(P₁,P₂)
  • d=2R atan2(√a,√(1−a)); a=sin²(Δφ/2)+cosφ₁ cosφ₂ sin²(Δλ/2); R=6371008.8m
  • WGS 84: a=6378137m; f=1/298.257223563
  • M=(P₁+P₂)/2; Δ=P₂−P₁
  • 1mi=1609.344m; 1nmi=1852m
2D — coordinate planeThe drawing identifies the points and the distance d.xyP₁P₂d
The drawing identifies the points and the distance d.
P₁ = (
)
P₂ = (
)
Digits to show, starting at the first nonzero digit.

Your result

Your answer and calculation steps appear here.

Inputs and calculations stay in this browser tab. Copy or export your report before closing.

How to calculate distance between two points

Enter each point in the labelled tuple. For a coordinate grid, use one common length unit or choose unitless. For Earth, use decimal degrees or degrees, minutes and seconds such as 23° 30′ 0″ N.

Choose the kind of distance

In one dimension, subtract and take the absolute value. In two or three dimensions, square the coordinate differences, add and take the square root. On Earth, choose a surface model; its shortest path generally curves on a flat map.

Work through a coordinate example

For P₁ = (1, 2) and P₂ = (4, 6), the changes are 3 and 4. The distance is √(9+16) = 5 and the midpoint is (5/2, 4). Reversing the points flips the changes and keeps the distance and midpoint. Use coordinates from the same axes and one unit.

Distance between the labelled pointsThe drawing identifies the points and the distance d.xyP₁P₂d
The drawing identifies the points and the distance d.

Enter latitude and longitude

Latitude goes from −90° to 90°, longitude from −180° to 180°. Negative latitude is south and negative longitude is west. In DMS, 23° 30′ 0″ S is −23.5°. Use N/S for latitude and E/W for longitude, or use a sign and no letter. Minutes and seconds must be less than 60.

Pick the Earth model

WGS 84 uses an equatorial radius of 6378137 m and inverse flattening 298.257223563. The sphere uses a fixed radius of 6371008.8 m. A quarter equator is about 10018.75 km on WGS 84 and 10007.56 km on the sphere. Neither estimates road mileage or altitude.

Distance between the labelled pointsThe drawing identifies the points and the distance d.P₁P₂
The drawing identifies the points and the distance d.

Read the map and azimuths

On the decimal-degree map, set or drag two points. The path can cross the date line and is drawn on both edges instead of through the map. The initial azimuth measures clockwise from north; arrival azimuth follows the continuing direction of that same path. Identical points have no direction, and an antipodal pair has no single direction reported. Other nearly antipodal pairs can also admit more than one shortest path.

Convert and keep the result

The international foot is 0.3048 m, the international mile is 1609.344 m, and the nautical mile is 1852 m. Coordinate results can retain an exact radical or fraction. Copy or download the labelled measurements and formula steps. The map is a low-detail overview, so use typed coordinates for precision.

Use the Slope Calculator when you need the rise, run or equation of a line through two points. The Root Calculator can simplify the square root in the distance formula and the Fraction Calculator can check exact coordinate differences. Use the Triangle Calculator for a triangle with measured sides, the Ratio Calculator to convert a map scale and the Area Calculator to calculate the area of the resulting plane shape. The Pythagorean Theorem Calculator shows the same square relationship for a right triangle and can check three measured sides.

OpenStax — Vectors in Three Dimensions derives the coordinate formula. NGA — World Geodetic System 1984 gives the WGS 84 ellipsoid parameters, and Karney — Geodesics on an Ellipsoid documents the inverse geodesic algorithm. NIST SP 811 — International Nautical Mile gives the nautical mile conversion; BIPM SI Brochure and ISO 80000-2:2019 cover units and notation.

Common questions

What is the distance from (1, 2) to (4, 6)?

It is 5 in the coordinate unit, because √[(4−1)²+(6−2)²] = 5.

How do I add a third coordinate?

Choose 3D and fill x, y and z for both points. The square of the z difference adds to the sum.

Are Earth results driving distances?

No. They are shortest surface distances on the selected model, without roads, elevation or obstacles.

Can I enter DMS coordinates?

Yes. Choose the degrees, minutes and seconds mode. For example, 30° 15′ 0″ W is −30.25° longitude.

Why do WGS 84 and sphere answers differ?

Earth is flattened in WGS 84. A sphere uses one constant radius, which produces slightly different distances.

What are significant digits?

They count from the first nonzero digit. At 3 significant digits, 123.456 rounds to 123. The setting changes the display, not the quality of the input.

Explore related tools