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- 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.
Distance Formula Calculator
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.
How to use the distance formula calculator
- Pick what to measure beside
Distance between:Two points,A point and a line, orTwo parallel lines. - 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.
- For a line, type its equation the way it is written in the problem:
y = 2x + 3,3x + 4y = 12orx = 5. - Read the distance at the top.
Workingsubstitutes 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.
Example
The distance between (1, 2) and (7, 6), with the working and the other figures the tool gives.
x₁: 1
y₁: 2
x₂: 7
y₂: 6Distance: 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.211103Details
- The distance formula, d = √((x₂ - x₁)² + (y₂ - y₁)²), is the Pythagorean theorem used on a right triangle drawn between the two points. The horizontal change Δx and the vertical change Δy are the legs, and the distance is the hypotenuse: d² = Δx² + Δy². From (1, 2) to (7, 6) the legs are 6 and 4, so d² = 36 + 16 = 52 and d = 2√13 ≈ 7.211103. Squaring removes any minus sign, so it does not matter which point you call the first. When the legs form a Pythagorean triple the distance is whole: (2, -1) to (5, 3) is 5.
- The 3D distance formula adds the change in z: d = √((x₂ - x₁)² + (y₂ - y₁)² + (z₂ - z₁)²). From (1, -2, 4) to (3, 1, -2) the changes are 2, 3 and -6, the squares add to 49 and the distance is 7. On a number line only x is left, and the square root of a square is the absolute value: d = |x₂ - x₁|, so 4 and -9 are 13 apart.
- The distance from a point to a line is measured along the perpendicular, the shortest way. Write the line in general form, Ax + By + C = 0, and use d = |A·x₀ + B·y₀ + C| / √(A² + B²). For the point (3, 4) and the line 3x + 4y = 12, that is 3x + 4y - 12 = 0 and |9 + 16 - 12| / √25 = 13/5 = 2.6; the closest point on the line, the foot of the perpendicular, is (1.44, 1.92). When √(A² + B²) is not whole the root is cleared from the bottom: from (1, 2) to y = 2x + 3 the distance is 3 / √5 = 3√5/5 ≈ 1.341641.
- The distance between parallel lines Ax + By + C₁ = 0 and Ax + By + C₂ = 0 is |C₁ - C₂| / √(A² + B²), once both are written with the same A and B. y = 2x + 3 and y = 2x - 7 become 2x - y + 3 = 0 and 2x - y - 7 = 0, so d = 10 / √5 = 2√5 ≈ 4.472136. Lines with different slopes are not parallel: they cross, and the tool shows where.
- The distance formula gives the Euclidean distance, the length of a straight line between the points. The Manhattan (taxicab) distance formula adds the absolute changes instead, |Δx| + |Δy|, the length of a path that only moves along the axes, so from (1, 2) to (7, 6) it is 10 against 2√13 ≈ 7.211103 in a straight line.
Limits
- Flat coordinates only. It does not measure the distance between two places on a map from latitude and longitude (that is a distance over a sphere), driving or walking distance, or distance from speed and time.
- Up to three dimensions for two points. It does not work backwards to a missing coordinate from a known distance, and it does not find the distance from a point to a plane or between skew lines in 3D: the point-to-line and parallel-line modes are in the x-y plane. It does not plot a graph.
- Each coordinate has at most 30 digits. Differences, squares and closest points are exact fractions; a distance that is not a whole square root is shown as a simplified root and rounded, marked ≈. Two lines that are not parallel are refused with where they meet: "Line 2: these lines are not parallel, so they cross, at (-2/3, 5/3), and the distance between them is 0. Parallel lines have the same slope: line 1 has slope 2, line 2 has slope -1."
FAQ
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.