Distance Calculator
Calculate the straight-line distance between two points in 2D or 3D space using the Pythagorean theorem. Useful for geometry, mapping, and physics problems.
Enter your values above to see the results.
Tips & Notes
- ✓Distance is always positive — squares eliminate sign. Δx=−3 gives Δx²=9 same as Δx=3.
- ✓Horizontal/vertical only: d = |x₂−x₁| or |y₂−y₁|. No square root needed.
- ✓Classic check: 3-4-5, 5-12-13, 8-15-17 are Pythagorean triples. Integer distances.
- ✓Midpoint is equidistant from both endpoints. Average both x and y coordinates.
- ✓3D distance: add z² term under the square root. Pattern extends to any dimension.
Common Mistakes
- ✗Forgetting to square differences. d = √((Δx)²+(Δy)²), not √(Δx+Δy).
- ✗√(3²+4²) = √25 = 5, not 3+4=7. Cannot add values inside a square root.
- ✗Confusing Euclidean (straight-line) with Manhattan (city-block) distance.
- ✗Swapping x and y coordinates. Point (3,7) has x=3, y=7 — confusion changes the result.
- ✗1D distance needs absolute value: |x₂−x₁|. x₂−x₁ alone can be negative.
Distance Calculator Overview
The distance between two points is one of the most fundamental measurements in mathematics and physics. In a two-dimensional coordinate plane, the straight-line Euclidean distance between any two points is derived directly from the Pythagorean theorem. Whether you are working on a geometry problem, building a map application, or analyzing data in machine learning, the distance formula appears constantly as a core building block.
The two-dimensional formula treats the horizontal and vertical separations as the two legs of a right triangle, with the straight-line distance as the hypotenuse:
d = √((x₂ − x₁)² + (y₂ − y₁)²)
EX: Points A(1, 2) and B(4, 6) → d = √((4−1)² + (6−2)²) = √(9+16) = √25 = 5The formula works regardless of which point you label first — squaring the differences eliminates any sign issues. The three-dimensional version simply adds a third squared term under the radical:
d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²)
EX: Points (0, 0, 0) and (3, 4, 12) → d = √(9 + 16 + 144) = √169 = 13The midpoint splits each coordinate exactly in half, landing equidistant from both endpoints:
Midpoint = ((x₁ + x₂) / 2, (y₁ + y₂) / 2)
EX: A(2, 4) and B(8, 10) → Midpoint = (5, 7)Distance is not a single concept — different applications call for different ways of measuring how far apart two points are. Each variant below has a specific context where it outperforms the others: - Euclidean distance — straight-line, shortest possible path. The default meaning of distance in mathematics. Used in geometry, physics, and machine learning algorithms like k-nearest neighbors and k-means clustering. - Manhattan distance — sum of absolute differences: |x₂−x₁| + |y₂−y₁|. Models grid movement where only horizontal and vertical steps are allowed, like navigating city blocks. Haversine distance: — accounts for the Earth being a sphere rather than a flat plane. Essential for GPS calculations over long distances.