Distance Formula Calculator

: Find the distance between two points in 2D, 3D or on a number line, from a point to a line, or between parallel lines, with exact working
Values
z is optional: leave it empty for 2D, and y too for a number line.
Whole numbers, decimals, negatives or fractions such as 3/4.
Exact: decimals and fractions are kept as fractions while calculating, so differences, squares, closest points and midpoints are exact. A distance that is not a whole square root is shown in simplest root form and rounded; ≈ marks a rounded figure.
Result
Distance
2√13 ≈ 7.211103
The straight-line (Euclidean) distance between the two points.
Working
d = √((x₂ - x₁)² + (y₂ - y₁)²) = √((7 - 1)² + (6 - 2)²) = √(6² + 4²) = √(36 + 16) = √52 = 2√13 ≈ 7.211103
Change in x (Δx)
6
x₂ - x₁ = 7 - 1
Change in y (Δy)
4
y₂ - y₁ = 6 - 2
Distance squared
52
d² = (Δx)² + (Δy)², the distance before the square root. Comparing squares compares distances.
Manhattan (taxicab) distance
10
|Δx| + |Δy| = 6 + 4: the distance moving only along the axes, as on a city grid.
Midpoint
(4, 4)
Halfway between the two points: the average of each coordinate.

A distance formula calculator for the straight-line distance between two points on a number line, in 2D or in 3D, from a point to a line, or between two parallel lines. Type coordinates or equations with whole numbers, decimals, negatives or fractions, and it gives the exact answer in simplest root form with a rounded decimal, plus the working step by step in your own numbers.

  1. Pick what to measure beside Distance between: Two points, A point and a line, or Two parallel lines.
  2. For two points, type x₁, y₁ and x₂, y₂. Add z₁ and z₂ for 3D, or leave y and z empty for two numbers on a number line.
  3. For a line, type its equation the way it is written in the problem: y = 2x + 3, 3x + 4y = 12 or x = 5.
  4. Read the distance at the top. Working substitutes your numbers into the formula; the rows below give the change in each coordinate, the Manhattan distance and the midpoint, or the closest point on the line and the perpendicular through your point.

The distance between (1, 2) and (7, 6), with the working and the other figures the tool gives.

Input
x₁: 1
y₁: 2
x₂: 7
y₂: 6
Output
Distance: 2√13 ≈ 7.211103
Change in x (Δx): 6
Change in y (Δy): 4
Distance squared: 52
Manhattan (taxicab) distance: 10
Midpoint: (4, 4)

Working:
d = √((x₂ - x₁)² + (y₂ - y₁)²)
  = √((7 - 1)² + (6 - 2)²)
  = √(6² + 4²)
  = √(36 + 16)
  = √52 = 2√13 ≈ 7.211103

What is the distance formula?

d = √((x₂ - x₁)² + (y₂ - y₁)²): subtract the coordinates, square each difference, add the squares and take the square root. It gives the straight-line distance between (x₁, y₁) and (x₂, y₂); for (1, 2) and (7, 6) it is 2√13 ≈ 7.211103.

How do you find the distance between two points?

Find how far apart they are in x and in y, square both numbers, add them and take the square root of the sum. From (2, -1) to (5, 3) the changes are 3 and 4, the squares are 9 and 16, the sum is 25 and the distance is 5.

What is the distance formula in 3D?

d = √((x₂ - x₁)² + (y₂ - y₁)² + (z₂ - z₁)²), the 2D formula with the change in z added under the root. Between (1, -2, 4) and (3, 1, -2) it is √(4 + 9 + 36) = 7.

How do you find the distance from a point to a line?

Put the line in the form Ax + By + C = 0, substitute the point into Ax + By + C, take the absolute value and divide by √(A² + B²). The point (3, 4) is 13/5 = 2.6 from 3x + 4y = 12.

Is the distance formula the Pythagorean theorem?

It is the Pythagorean theorem, a² + b² = c², solved for c. The changes in x and y are the two shorter sides of a right triangle and the distance between the points is the longest side, so for legs of 6 and 4 the distance is √52 = 2√13 ≈ 7.211103.

Runs entirely in your browser. Nothing is uploaded.