Distance Calculator

The Distance Calculator handles three types of distance problems: 2D Coordinates for geometry and graph problems using the Pythagorean theorem (also shows Manhattan distance, midpoint, and slope), 3D Coordinates for three-dimensional space problems (Euclidean distance + midpoint), and Lat/Long (Geographic) for real-world map distances between any two locations using the Haversine formula — the same method GPS devices use to calculate straight-line distance. Results are shown in both kilometers and miles for geographic mode, and the unit you enter for coordinate modes.

star 4.9
New
Point A
Point B
straighten

Enter two points to calculate distance

functions Distance Formulas

2D Euclidean
d = √((x₂−x₁)² + (y₂−y₁)²)
3D Euclidean
d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²)
Manhattan (L1)
d = |x₂−x₁| + |y₂−y₁|
Midpoint
M = ((x₁+x₂)/2, (y₁+y₂)/2)
Earth Radius (R)
6,371 km · 3,959 mi

public Lat/Long Quick Reference

1° latitude ≈ 111 km / 69 mi
1° longitude @ equator ≈ 111 km
1° longitude @ 45° ≈ 79 km
NY → London ≈ 5,570 km
Earth circumference 40,075 km

lightbulb Quick Tips

  • Euclidean ≤ Manhattan — straight line is always shortest
  • Lat/Long gives great-circle (as-the-crow-flies), not driving distance
  • Negative latitude = South; negative longitude = West
  • Use decimal degrees: 40°42′46″N → 40.7128

How to Use This Calculator

place

Choose Distance Type

Select 2D Coordinates for flat-plane geometry, 3D Coordinates for space problems, or Lat/Long for real-world geographic distances.

edit_note

Enter Point Coordinates

Input the x and y values (and z for 3D) for both points. For geographic mode, enter latitude and longitude in decimal degrees.

straighten

Get Your Distance

See the straight-line distance instantly. 2D mode also shows Manhattan distance and the midpoint coordinates.

functions

Check the Formula

The step-by-step calculation is shown below the result so you can verify the math or learn how it was computed.

The Formula

The 2D distance formula is a direct application of the Pythagorean theorem in a coordinate plane. For 3D, an extra squared difference term is added under the radical. The Haversine formula handles the curvature of the Earth, giving the shortest great-circle distance (as-the-crow-flies) between two geographic points.

2D: d = √((x₂-x₁)² + (y₂-y₁)²) | 3D: d = √((x₂-x₁)² + (y₂-y₁)² + (z₂-z₁)²) | Haversine: d = 2R·arcsin(√(sin²(Δφ/2) + cos φ₁·cos φ₂·sin²(Δλ/2)))

lightbulb Variables Explained

  • (x₁,y₁), (x₂,y₂) Coordinates of the two points in 2D space
  • (x₁,y₁,z₁), (x₂,y₂,z₂) Coordinates of the two points in 3D space
  • φ (phi) Latitude in radians
  • λ (lambda) Longitude in radians
  • R Earth's mean radius ≈ 6,371 km
  • Δφ, Δλ Difference in latitude and longitude between the two points

tips_and_updates Pro Tips

1

The Euclidean distance is the 'straight-line' distance — the shortest possible path between two points.

2

Manhattan distance (also called taxicab or L1 distance) counts only horizontal + vertical movement — useful for grid-based problems.

3

For latitude/longitude: 1 degree of latitude ≈ 111 km (69 miles). Longitude degrees vary with latitude.

4

The Haversine formula gives the great-circle distance — the shortest path over the Earth's surface, not driving distance.

5

For 3D distance: think of it as applying the Pythagorean theorem twice — once in the XY plane, then including the Z dimension.

Frequently Asked Questions

sell

Tags

verified

Data sourced from trusted institutions

All formulas verified against official standards.