easyonlinecalculator

Distance Calculator

Pick a mode, enter two points and get the straight-line distance at once. Use x, y coordinates, x, y, z coordinates, or the latitude and longitude of two places. The result shows the midpoint for coordinates, kilometers, miles and nautical miles for places, and every step of the working. This is straight-line distance, not driving distance.

Last updated November 4, 2026

Result

Distance = 5

Distance results
Distance5
Midpoint(1.5, 2)

Straight-line distance in the same units as your coordinates. Rounded to 4 decimal places.

Show the work

Formula: d = sqrt((x2 - x1)^2 + (y2 - y1)^2)

  1. Differences: dx = 3 - 0 = 3; dy = 4 - 0 = 4.
  2. Square them: 3^2 = 9; 4^2 = 16.
  3. Add and take the square root: sqrt(25) = 5.
  4. Midpoint = ((0 + 3) / 2, (0 + 4) / 2) = (1.5, 2).

Result: Distance = 5

How the distance between two points is calculated

Formula

d = √((x2 − x1)² + (y2 − y1)²) · 3D adds (z2 − z1)² · Earth: d = R × c

For two points on a flat plane, the distance is the length of the hypotenuse of a right triangle whose legs are the horizontal and vertical differences. Subtract the coordinates, square each difference, add the squares and take the square root. This is the Pythagorean theorem. In three dimensions you add a third squared difference for the z coordinate. The midpoint is simply the average of each coordinate.

For two places on Earth, a flat formula does not work over long distances because the surface is curved. The calculator uses the haversine formula, which gives the great-circle distance: the shortest path along the surface of a sphere. It first finds the central angle c between the two places from their latitudes and longitudes, then multiplies it by the Earth radius R. The radius used is 6,371.0088 kilometers, the mean radius of the Earth as defined by the International Union of Geodesy and Geophysics.

Miles and nautical miles come from kilometers by exact definitions: 1 mile is 1.609344 km and 1 nautical mile is 1.852 km.

See how we calculate for the formulas, sources and review schedule behind every calculator.

Also useful alongside this calculator: Length Converter, Trigonometry Calculator and Geometry Calculator.

Straight-line distance is not driving distance

Every result here is a straight line: through the plane or space for coordinates, and along the curved surface of the Earth for latitude and longitude. It ignores roads, rivers, mountains, borders and flight corridors. A road trip is almost always longer than the straight line between two cities, and the gap depends on the terrain and how direct the road network is.

Distance on a graph and in 3D

On a graph, the two points can use any unit as long as both use the same one. If the coordinates are in meters, the distance is in meters. Points (0, 0) and (3, 4) are exactly 5 apart, and (0, 0, 0) and (1, 2, 2) are exactly 3 apart.

The order of the points does not matter, and negative coordinates are fine.

Entering latitude and longitude

Use decimal degrees. Latitude runs from −90 at the South Pole to 90 at the North Pole, and longitude runs from −180 to 180. North and east are positive, south and west are negative, so New York is about 40.7128, −74.0060. Values outside these ranges are rejected with a message.

How accurate the great-circle result is

The Earth is slightly flattened at the poles, not a perfect sphere. Treating it as a sphere with the mean radius keeps the result within about 0.5% of the ellipsoidal distance used by survey-grade tools, which is a few kilometers over a transatlantic flight. That is plenty for planning and comparison but not for surveying or navigation.

Results are rounded to two decimal places for places and four for coordinates. The antipodal case, two points exactly opposite on the globe, gives half the circumference: π × 6,371.0088 ≈ 20,015.11 km.

How to use the Distance Calculator

  1. Choose a mode: 2D points, 3D points or latitude and longitude.
  2. Enter the coordinates of point 1 and point 2. Latitude must be −90 to 90 and longitude −180 to 180.
  3. Read the distance and midpoint, or the distance in kilometers, miles and nautical miles.
  4. Open Show the work to follow each step, then use Copy or Share.

Worked example

Worked example

For points (0, 0) and (3, 4), dx = 3 and dy = 4, so the distance is √(9 + 16) = √25 = 5 and the midpoint is (1.5, 2). For London (51.5074, −0.1278) and Paris (48.8566, 2.3522), the central angle is about 0.0539 radians, and 6,371.0088 × 0.0539 gives about 343.6 km, or 213.5 miles. Real road and rail routes between the two cities are longer than this straight line.

Sample distances from the calculator
PointsDistanceMilesNautical miles
(0, 0) to (3, 4)5--
(0, 0, 0) to (1, 2, 2)3--
London to Paris343.6 km213.5185.5
New York to Los Angeles3,935.8 km2,445.62,125.1
Antipodal points20,015.1 km12,436.810,807.3

Frequently asked questions

Is this the driving distance between two cities?

No. It is the straight-line (great-circle) distance over the Earth surface, so real road distances are usually longer.

What formula finds the distance between two points?

On a plane it is the square root of the squared x difference plus the squared y difference, adding a z term in 3D. For places on Earth it is the haversine formula.

How accurate is the latitude and longitude distance?

It assumes a spherical Earth with a 6,371.0088 km radius, so it can differ from ellipsoidal results by up to about 0.5 percent.

What is a nautical mile in kilometers?

A nautical mile is exactly 1.852 kilometers, which is about 1.1508 statute miles. A statute mile is exactly 1.609344 kilometers.

Are my coordinates stored anywhere?

No. The calculation runs in your browser, and nothing you enter is saved or uploaded unless you choose to share a link.