Distance Calculator
Coordinate 1
Enter as x, y
Coordinate 2
Enter as x, y
Formula: Distance = √((x₂ − x₁)² + (y₂ − y₁)²)
Distance
distance calculator

How to Use the Distance Calculator

  1. Choose 2D Plane, 3D Plane, or Latitude & Longitude.
  2. Enter Coordinate 1 (or Point 1) in the format shown in the placeholder.
  3. Enter Coordinate 2 (or Point 2).
  4. Click “Calculate” to see the distance instantly.

Features of the Distance Calculator

  • Calculates straight-line distance between two points on a 2D plane.
  • Calculates straight-line distance between two points in 3D space.
  • Calculates real-world great-circle distance between two latitude/longitude coordinates using the Haversine formula.
  • Latitude & Longitude results shown in both kilometers and miles.
  • Free to use with no sign-up required.

Distance Formulas

The distance formula used depends on whether the points are on a flat plane or on the surface of the Earth.

2D Plane: Distance = √((x₂ − x₁)² + (y₂ − y₁)²)

3D Plane: Distance = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²)

Latitude & Longitude: uses the Haversine formula, which accounts for the Earth’s curvature (radius ≈ 6,371 km) rather than treating the two points as being on a flat surface.

Famous City Distances (Reference Table)

FromToDistance (km)Distance (mi)
New York (40.7128, −74.0060)Los Angeles (34.0522, −118.2437)3,935.752,445.56
London (51.5074, −0.1278)Paris (48.8566, 2.3522)343.56213.48

How to Calculate Distance Between Two Points

For points on a flat plane, subtract the x-coordinates and y-coordinates, square each difference, add them together, and take the square root.

Suppose Coordinate 1 is (3, 4) and Coordinate 2 is (7, 1). Distance = √((7−3)² + (1−4)²) = √(16 + 9) = √25 = 5.

Thus, the distance between (3, 4) and (7, 1) is 5.

Solved Examples on Distance Calculation

1. 2D Plane Distance

Example: Find the distance between (3, 4) and (7, 1).
Distance = √((7−3)² + (1−4)²) = √25 = 5.

2. 3D Plane Distance

Example: Find the distance between (1, 2, 3) and (4, 6, 3).
Distance = √((4−1)² + (6−2)² + (3−3)²) = √(9 + 16 + 0) = √25 = 5.

3. 3D Plane Distance With Negative Coordinates

Example: Find the distance between (2, −1, 4) and (5, 3, 8).
Distance = √((5−2)² + (3−(−1))² + (8−4)²) = √(9 + 16 + 16) = √41 ≈ 6.403124.

4. Latitude & Longitude (Great-Circle Distance)

Example: Find the distance between New York (40.7128, −74.0060) and Los Angeles (34.0522, −118.2437).
Using the Haversine formula, the great-circle distance is approximately 3,935.75 km, or 2,445.56 miles.

1. What’s the difference between 2D, 3D, and Latitude & Longitude distance?

2D and 3D distance treat points as being on a flat plane or in flat 3D space, using the Pythagorean theorem. Latitude & Longitude distance accounts for the Earth’s curved surface using the Haversine formula, giving accurate real-world distances between two geographic coordinates.

2. Why can’t I use the 2D formula for latitude and longitude?

Latitude and longitude are angles on a sphere, not flat coordinates, so treating them as x-y points with the Pythagorean theorem produces an inaccurate result, especially over long distances. The Haversine formula properly accounts for the Earth’s curvature.

3. What is the Haversine formula?

The Haversine formula calculates the great-circle distance between two points on a sphere given their latitude and longitude, using the sine of half the difference in each coordinate along with the Earth’s radius, approximately 6,371 kilometers.

4. How accurate is the Haversine formula?

The Haversine formula is accurate to within about 0.5%, since it assumes the Earth is a perfect sphere rather than the slightly flattened ellipsoid it actually is. This is precise enough for most navigation, mapping, and distance-estimation purposes.

5. Can I use negative coordinates?

Yes, negative coordinates work in both the 2D and 3D modes, and negative values are expected for latitude (southern hemisphere) and longitude (western hemisphere) in the Latitude & Longitude mode.

6. What format should coordinates be entered in?

Coordinates are entered as comma-separated values, such as “3, 4” for 2D, “3, 4, 2” for 3D, or “40.7128, -74.0060” for latitude and longitude in decimal degrees.

Maths Related Posts