Distance Calculator
How to find the distance between two points
Enter the (x, y) coordinates of both points and press Calculate. The distance formula d = √((x₂−x₁)² + (y₂−y₁)²) is applied with every step shown.
Worked example
Distance between (1, 2) and (4, 6): d = √((4−1)² + (6−2)²) = √(9 + 16) = √25 = 5.
Frequently asked questions
d = √((x₂−x₁)² + (y₂−y₁)²). It comes from the Pythagorean theorem applied to the horizontal and vertical differences.
No. Squaring removes the sign, so (x₁,y₁)→(x₂,y₂) gives the same distance as the reverse.
Yes. Differences like (−1) − 3 = −4 are squared, so negatives work fine.
How the distance formula works
The two points form the ends of a slanted segment. Draw a right triangle under that segment and the horizontal change becomes one leg, the vertical change becomes the other leg, and the distance itself is the hypotenuse. That is why the formula squares both changes, adds them, and then takes the square root.
Read it in three moves. First subtract the x coordinates to get the horizontal change, then subtract the y coordinates to get the vertical change. Square each change, add the squares, and finish with the square root. The root matters: without it you have the squared distance, not the distance.
Example: Distance between (-2, 3) and (4, -5)
Step 1, Subtract: The horizontal change is 4 – (-2) = 6. The vertical change is -5 – 3 = -8.
Step 2, Square and add: 6^2 + (-8)^2 = 36 + 64 = 100. The negative sign disappears when you square.
Step 3, Take the root: d = sqrt(100) = 10. The two points are 10 units apart.
Common mistakes
- Forgetting the square root: Stopping at 100 in the example above gives the squared distance. Always finish with sqrt.
- Mismatching coordinates: Pair x with x and y with y. Mixing a y value into the x subtraction gives a wrong pair of changes.
- Dropping a negative sign: Subtracting a negative adds, so 4 – (-2) is 6, not 2. Write the brackets out before you simplify.
When to use the distance formula
Use it whenever you know two positions on a grid and need the straight line gap between them: the length of a segment in a geometry problem, the separation between two points on a map grid, or the size of a vector from its components. If you only need the middle of the segment rather than its length, that is a midpoint problem instead.
More questions
The segment is then vertical or horizontal, and one change is zero. The formula still works, and the distance is simply the absolute difference of the other coordinate.
Treat the origin as (0, 0). The formula becomes d = sqrt(x^2 + y^2). For the point (6, 8), that gives sqrt(36 + 64) = sqrt(100) = 10.
Yes, with one extra term. For points in 3D, d = sqrt((x2 – x1)^2 + (y2 – y1)^2 + (z2 – z1)^2). This calculator works with two dimensional points.