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.

Distance Calculations Between Points and Coordinates

Distance calculation is fundamental to navigation, surveying, physics, and everyday trip planning. Whether you need the straight-line distance between two GPS coordinates, the Euclidean distance between points in 2D or 3D space, or the driving distance between cities, the underlying mathematics connects geometry to real-world measurement. The 2D Euclidean distance formula d = √((x₂-x₁)² + (y₂-y₁)²) extends to 3D by adding the z-component, while the Haversine formula accounts for Earth's curvature when computing great-circle distances between latitude-longitude coordinates. Our distance calculator handles all these scenarios: enter two points in Cartesian coordinates (2D or 3D) or geographic coordinates (latitude/longitude) to compute the distance in your preferred units — miles, kilometers, meters, feet, or nautical miles. It shows the calculation steps, heading/bearing between points, and midpoint coordinates.

Euclidean distance in 2D and 3D

The Euclidean distance formula derives from the Pythagorean theorem. In 2D: d = √((x₂-x₁)² + (y₂-y₁)²). Between points (3,4) and (7,1): d = √((7-3)² + (1-4)²) = √(16+9) = √25 = 5 units. In 3D, add the z-component: d = √((x₂-x₁)² + (y₂-y₁)² + (z₂-z₁)²). For higher dimensions (common in machine learning and data science), the same pattern extends: d = √(Σ(xi-yi)²). Manhattan distance (L1 norm), computed as |x₂-x₁| + |y₂-y₁|, measures distance along grid lines — relevant for city block navigation where diagonal travel is impossible. Chebyshev distance (L∞ norm) takes the maximum coordinate difference, useful in chess (king moves) and warehouse robotics.

Great-circle distance using the Haversine formula

For points on Earth's surface, the Haversine formula computes the shortest distance along the sphere: a = sin²(Δlat/2) + cos(lat₁) × cos(lat₂) × sin²(Δlon/2), d = 2R × arcsin(√a), where R = 6,371 km (Earth's mean radius). The distance from New York (40.7128°N, 74.0060°W) to London (51.5074°N, 0.1278°W) computes to approximately 5,570 km (3,461 miles). This is the great-circle distance — the shortest path over Earth's surface, which aircraft follow (roughly). Actual flight distances are 5-10% longer due to air traffic routing, wind patterns, and restricted airspaces. The Vincenty formula provides slightly more accurate results (accounting for Earth's oblate spheroid shape) but the Haversine error is typically under 0.3%.

Practical distance estimation tips

For quick mental estimates: 1 degree of latitude ≈ 111 km (69 miles) everywhere on Earth. 1 degree of longitude ≈ 111 km at the equator but shrinks by cos(latitude) — at 45°N, it is approximately 78.5 km; at 60°N, it is only 55.5 km. GPS accuracy is typically 3-5 meters for consumer devices and 1-2 cm for survey-grade RTK systems. For road distance estimation, multiply straight-line distance by 1.3-1.5 (the circuity factor — roads are rarely straight). Urban areas have higher circuity (1.4-1.8) due to grid patterns and obstacles, while highway routes between distant cities approach 1.2-1.3. Google Maps API provides actual driving distances, but for quick planning, the straight-line distance × 1.4 gives a reasonable road distance estimate.

Frequently Asked Questions

sell

Tags

verified

Data sourced from trusted institutions

All formulas verified against official standards.