Distance Calculator

📐 Geometry & GPS Tool

Distance
Calculator

Calculate distance between two points in 2D, 3D, or using GPS coordinates (latitude & longitude) — with step-by-step working, canvas diagram, and midpoint coordinates.

🗺️ Engineering & GIS Friendly
⚡ Fast Coordinate Calculations
✓ Accurate Geometry & GPS Results
↕ Point 2 (x₂, y₂)
Distance
—
—
📍 Coordinate summary
Midpoint—
Δx (horizontal)—
Δy (vertical)—
📊 Coordinate diagram (blue = distance line · green = points · amber = midpoint)
📐 Step-by-step solution
💡 Geometry insights:
—
ℹ️ This calculator provides educational and estimation-based coordinate calculations. GPS distances use the Haversine formula with a spherical Earth model (R = 6,371 km) — actual geodetic distances may differ slightly due to Earth’s ellipsoidal shape.

Distance Calculator: Calculate 2D, 3D & GPS Distances Instantly

Whether you’re solving a geometry problem, calculating the distance between GPS coordinates, or working on an engineering or game development project — this free distance calculator handles all three types: 2D Euclidean distance between (x, y) points, 3D distance through (x, y, z) space, and real-world geographic distance between any two latitude/longitude coordinates using the Haversine formula.

📐 Core formulas:
2D: d = √((x₂−x₁)² + (y₂−y₁)²)
3D: d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²)
GPS: Haversine formula with Earth radius R = 6,371 km

Formula Reference Table

ModeFormulaUse caseExample
2D√(Δx²+Δy²)Geometry, maps, 2D games(0,0)→(3,4) = 5
3D√(Δx²+Δy²+Δz²)CAD, 3D graphics, engineering(0,0,0)→(1,2,2) = 3
GPSHaversine (R=6371)Navigation, GIS, travelLondon→Paris = 341 km

Real-World Applications

🏗️

Engineering & CAD

3D distance calculations are foundational in mechanical and structural engineering. CAD software uses Euclidean distance for clearance checking, collision detection, and dimensional tolerancing. Robotic arm reach calculations, CNC toolpath planning, and finite element analysis all rely on 3D distance formulas.

🌍

GPS & navigation

The Haversine formula calculates great-circle distance — the shortest path along the Earth’s surface. Aviation uses it for flight planning, shipping uses it for routing, and mapping apps use it for “as the crow flies” distance displays. For distances under 100km, the flat-Earth approximation is accurate to within 0.1%.

🎮

Game development

2D and 3D distance calculations power collision detection, pathfinding, and line-of-sight checks in games. A common pattern: compare distance² to avoid the expensive square root when only relative distances matter (e.g. “is enemy within range?”). Unity, Unreal, and Godot all expose distance calculation utilities based on these formulas.

📡

GIS & surveying

Geographic Information Systems use coordinate distance for spatial analysis — buffer zones, nearest-neighbour searches, and proximity calculations. Professional surveyors use geodetic formulas that account for Earth’s ellipsoidal shape (WGS84), which is slightly more accurate than the spherical Haversine model for very long distances.

Related Calculators

Frequently Asked Questions

How do you calculate distance between two points?
In 2D geometry, use the Euclidean distance formula: d = √((x₂−x₁)² + (y₂−y₁)²). This is derived directly from the Pythagorean theorem — the distance is the hypotenuse of a right triangle formed by the horizontal (Δx) and vertical (Δy) differences. For a 3D version, add a third term: d = √(Δx²+Δy²+Δz²). For real-world GPS coordinates, the Haversine formula accounts for Earth’s curvature. The calculator above handles all three modes automatically.
What is the Haversine formula?
The Haversine formula calculates the great-circle distance between two points on a sphere given their latitudes and longitudes. “Haversine” refers to the haversine function: hav(θ) = sin²(θ/2). The formula: a = sin²(Δlat/2) + cos(lat₁)·cos(lat₂)·sin²(Δlon/2); c = 2·atan2(√a, √(1−a)); d = R·c, where R is Earth’s mean radius (6,371 km). It’s accurate to within about 0.3% for most distances, with errors increasing slightly for antipodal points.
What is the 3D distance formula?
The 3D distance formula extends the 2D Pythagorean theorem to three dimensions: d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²). It calculates the straight-line Euclidean distance through 3D space. Example: distance from point (0,0,0) to (1,2,2) = √(1²+2²+2²) = √(1+4+4) = √9 = 3. This formula is fundamental in 3D computer graphics, physics simulations, robotics, and CAD engineering.
What are latitude and longitude coordinates?
Latitude measures the north-south position from the equator (0°) to the poles (±90°). Positive values are north, negative south. Longitude measures east-west position from the Prime Meridian in Greenwich (0°) to ±180°. Positive values are east, negative west. Together, any location on Earth can be described as (latitude, longitude) — for example, London is approximately (51.5074°N, −0.1278°W), or in decimal degrees: (51.5074, −0.1278).
How does Earth curvature affect distance calculations?
For short distances (under ~50km), the flat-Earth approximation gives negligible errors — the curvature is too subtle to matter. As distances increase, the great-circle path (following the Earth’s surface) diverges meaningfully from a straight-line calculation. For long distances like London to Sydney (~17,000 km), the Haversine result is accurate to within about 0.3%, while a simple flat calculation would be completely wrong. The Haversine formula used in this calculator assumes a spherical Earth — professional geodesy uses the ellipsoidal WGS84 model (Vincenty formula) for the highest accuracy.

Calculate distances instantly

2D geometry, 3D space, GPS coordinates — step-by-step working, free and instant.

Calculate distance ↑