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.
Enter two points to calculate distance
functions Distance Formulas
public Lat/Long Quick Reference
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
Choose Distance Type
Select 2D Coordinates for flat-plane geometry, 3D Coordinates for space problems, or Lat/Long for real-world geographic distances.
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.
Get Your Distance
See the straight-line distance instantly. 2D mode also shows Manhattan distance and the midpoint coordinates.
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
The Euclidean distance is the 'straight-line' distance — the shortest possible path between two points.
Manhattan distance (also called taxicab or L1 distance) counts only horizontal + vertical movement — useful for grid-based problems.
For latitude/longitude: 1 degree of latitude ≈ 111 km (69 miles). Longitude degrees vary with latitude.
The Haversine formula gives the great-circle distance — the shortest path over the Earth's surface, not driving distance.
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
Related Tools
View all Math View all arrow_forwardTags
Data sourced from trusted institutions
All formulas verified against official standards.