📍 Distance Calculator
Calculate the straight-line distance between two points in 2D or 3D space, plus midpoint, slope, and coordinate changes. All results shown with step-by-step working.
Point 1
Point 2
What is Distance?
Distance is the total length of the path between two points in space. In everyday terms, it is the measurement of how far apart two locations are — whether on a number line, a coordinate plane, or in three-dimensional space. Distance is always a non-negative value expressed in units of length such as metres, kilometres, miles, or light-years.
In coordinate geometry, the Euclidean distance formula calculates the straight-line (as-the-crow-flies) distance between two points. For points (x₁, y₁) and (x₂, y₂), the formula derives from the Pythagorean theorem: d = √((x₂−x₁)² + (y₂−y₁)²). This formula extends naturally into three dimensions by adding a third squared difference under the radical.
Distance is distinct from displacement. Displacement is the straight-line distance and direction between a start point and end point, while distance accounts for the total path travelled. If you walk 3 km east and then 3 km west, your displacement is zero but your distance walked is 6 km — a distinction fundamental to physics and navigation.
Distance Formulas
Worked Example — Points (1, 1) and (4, 5)
How the Distance Calculator Works
Formula, assumptions, and calculation steps for this math tool.
Formula Used
d = sqrt((x2 - x1)^2 + (y2 - y1)^2)
Methodology
Applies the distance formula, derived from the Pythagorean theorem, to two coordinate points.
Calculation Steps
- Read the values and operation selected.
- Normalize signs, decimals, fractions, or units if needed.
- Apply the mathematical rule or formula.
- Format the answer and any intermediate values for checking.
Assumptions and Limits
- Inputs must be within the supported domain of the operation.
- Decimal answers may be rounded for readability.
- Symbolic simplification is limited to the calculator scope.
Frequently Asked Questions
The distance formula calculates the straight-line (Euclidean) distance between two points. In 2D: d = √((x₂−x₁)² + (y₂−y₁)²). It is derived directly from the Pythagorean theorem, where Δx and Δy form the two legs of a right triangle.
The midpoint is the exact centre of the line segment connecting two points. It is found by averaging the x-coordinates and y-coordinates separately: M = ((x₁+x₂)/2, (y₁+y₂)/2).
Extend the formula to include a third dimension: d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²). This is still based on the Pythagorean theorem, applied twice across three axes.
The distance formula is used in GPS navigation (great-circle distance), computer graphics (collision detection, ray tracing), machine learning (k-nearest neighbours), robotics (path planning), and mapping applications for measuring straight-line distances between coordinates.
Real-World Applications
Common Mistakes
Distance Formula Reference
| Formula Type | Formula | Use Case |
|---|---|---|
| Euclidean (2D) | √((x₂−x₁)² + (y₂−y₁)²) | Points on a plane |
| Euclidean (3D) | √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²) | Points in space |
| Manhattan | |x₂−x₁| + |y₂−y₁| | Grid navigation (city blocks) |
| Chebyshev | max(|x₂−x₁|, |y₂−y₁|) | Chess king moves |
| Haversine | Spherical trig formula | GPS / Earth surface distance |
References
- Euclid. Elements, Book I. c. 300 BC (T.L. Heath translation, Dover, 1956).
- Apostol, Tom M. Calculus, Vol. 1. Wiley, 1991.
- Stewart, James. Calculus: Early Transcendentals. Cengage Learning, 2015.
- Deza, Michel & Deza, Elena. Encyclopedia of Distances. Springer, 2016.
- NIST. Digital Library of Mathematical Functions. National Institute of Standards and Technology, 2024.
Related Calculators
Browse all Math calculators →Slope Calculator
Calculate slope, y-intercept, angle, and line equation from two points.
Pythagorean Theorem Calculator
Calculate the missing side of a right triangle using the Pythagorean theorem.
Geometry Calculator
Calculate area, perimeter, volume and other properties of geometric shapes.