Distance Calculator — Find Distance Between Two Points
Calculate the distance between two points in a 2D coordinate plane using the distance formula. Also find the midpoint, slope, and line equation. See also our Midpoint Calculator and Slope Calculator.
How to Find the Distance Between Two Points
- Identify the coordinates of both points: (x1, y1) and (x2, y2).
- Subtract the x-coordinates and square the result.
- Subtract the y-coordinates and square the result.
- Add the two squared values together.
- Take the square root of the sum to get the distance.
Formula
Distance = sqrt((x2 - x1)² + (y2 - y1)²)
Midpoint = ((x1 + x2) / 2, (y1 + y2) / 2)
Slope = (y2 - y1) / (x2 - x1)
Line: y = mx + b, where b = y1 - m × x1Example
Points (1, 2) and (4, 6):
Distance = sqrt((4 - 1)² + (6 - 2)²) = sqrt(9 + 16) = sqrt(25) = 5
Midpoint = ((1 + 4)/2, (2 + 6)/2) = (2.5, 4)
Slope = (6 - 2) / (4 - 1) = 4/3 = 1.3333
Line: y = 1.3333x + 0.6667
Common Coordinate Pairs and Distances
| Point 1 | Point 2 | Distance | Midpoint |
|---|---|---|---|
| (0, 0) | (1, 1) | 1.4142 | (0.5, 0.5) |
| (0, 0) | (3, 4) | 5.0000 | (1.5, 2) |
| (1, 2) | (4, 6) | 5.0000 | (2.5, 4) |
| (0, 0) | (5, 12) | 13.0000 | (2.5, 6) |
| (-3, -4) | (3, 4) | 10.0000 | (0, 0) |
| (2, 3) | (8, 11) | 10.0000 | (5, 7) |
| (0, 0) | (1, 0) | 1.0000 | (0.5, 0) |
| (0, 0) | (0, 1) | 1.0000 | (0, 0.5) |
Frequently Asked Questions
What is the distance formula derived from?
The distance formula is derived from the Pythagorean theorem. The horizontal and vertical differences form the legs of a right triangle, and the distance is the hypotenuse.
Can this calculate 3D distance?
This calculator works for 2D coordinates. For 3D, the formula extends to d = sqrt((x2-x1)² + (y2-y1)² + (z2-z1)²).
What if the slope is undefined?
The slope is undefined when x1 = x2 (a vertical line). The distance formula still works; only the slope and line equation are affected.
How is this different from Manhattan distance?
Euclidean distance (this calculator) measures the straight-line distance. Manhattan distance measures the sum of horizontal and vertical distances: |x2-x1| + |y2-y1|.
Can distance be negative?
No. Distance is always non-negative because it involves squaring differences and taking a square root. A distance of zero means the two points are identical.