Advertisement

📍 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

Distance Formulas

2D Distance: d = √((x₂−x₁)² + (y₂−y₁)²)
3D Distance: d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²)
Midpoint 2D: M = ((x₁+x₂)/2 , (y₁+y₂)/2)
Midpoint 3D: M = ((x₁+x₂)/2 , (y₁+y₂)/2 , (z₁+z₂)/2)
Slope: m = (y₂−y₁) / (x₂−x₁)

Worked Example — Points (1, 1) and (4, 5)

Δx = 4 − 1 = 3
Δy = 5 − 1 = 4
d = √(3² + 4²) = √(9 + 16) = √25 = 5
Midpoint = ((1+4)/2, (1+5)/2) = (2.5, 3)
Slope = 4 / 3 ≈ 1.333

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.

Related Calculators