What is the distance between two points?
The distance between two points is the length of the straight line joining them — the shortest path from one to the other. On a graph, the points (0, 0) and (3, 4) are 5 units apart, even though the gap is 3 across and 4 up. The straight line is shorter than walking across and then up, which would be 7 units.
This distance calculator takes two points and returns that straight-line distance, along with the separate x-gap and y-gap. Type the points in and the answer updates live. It is the same calculation used in school coordinate geometry, in maps, and in any software that measures how far apart two things are.
The idea is simple but the uses are wide. Game developers use it to check how far a character is from an enemy, delivery apps use it for straight-line distances between addresses, and surveyors use it to measure plots of land. Any time two positions are known and the gap matters, this is the number.
How the distance formula works — it is the Pythagoras theorem
The formula is distance = √((x2 − x1)² + (y2 − y1)²). First find the horizontal gap and the vertical gap, square both, add them, and take the square root. For the default points (0, 0) and (3, 4), the gaps are 3 and 4, so the distance is √(3² + 4²) = √(9 + 16) = √25 = 5.
That is exactly the Pythagoras theorem: in a right-angled triangle, the square of the longest side equals the sum of the squares of the other two sides. The two gaps form the short sides of a right-angled triangle, and the distance is the hypotenuse. The 3-4-5 triangle is the most famous example — whole numbers all the way through.
The squaring step is what makes the order of the points irrelevant and the sign of each gap irrelevant. A gap of −3 squares to 9, the same as a gap of 3, so the distance from A to B is always the same as from B to A. A square root calculator does the final step when you work it out by hand.
The x-gap and y-gap explained
The two gaps, Δx and Δy, are the building blocks of the distance. Δx is simply x2 − x1, the horizontal distance between the points, and Δy is y2 − y1, the vertical distance. For (0, 0) and (3, 4), Δx is 3 and Δy is 4, and those two numbers are shown beside the distance so you can check the working.
The gaps can be negative, and that is fine. If the second point is to the left of the first, Δx is negative; if it is below, Δy is negative. The signs vanish when the gaps are squared, so a negative gap contributes exactly as much as a positive one of the same size. The direction is lost, but the distance is a length, and lengths have no direction.
When one gap is zero, the distance is just the other gap. Points (2, 5) and (9, 5) share the same y-value, so Δy is 0 and the distance is simply Δx, which is 7. The same applies vertically: points with the same x are separated by Δy alone. The formula still works — it just collapses to a single subtraction.
A worked example: the 3-4-5 triangle, twice
Start with the defaults, (0, 0) and (3, 4). The x-gap is 3 − 0 = 3 and the y-gap is 4 − 0 = 4. Square them: 9 and 16. Add them: 25. Take the square root: 5. The distance is 5 units, a clean whole number because 3, 4 and 5 form a Pythagorean triple.
Double the gaps and the distance doubles too. The points (0, 0) and (6, 8) have gaps of 6 and 8, so the distance is √(36 + 64) = √100 = 10. Scaling both gaps by the same factor scales the distance by that factor — a handy check when you are estimating distances on a map.
Now move the same pair away from the origin: (1, 1) and (4, 5). The gaps are still 4 − 1 = 3 and 5 − 1 = 4, so the distance is still 5. Distance depends only on the gaps, never on where the points sit. Shifting both points by the same amount changes nothing, which is why maps can be drawn at any origin.
Where distance between points gets used
In school, this is coordinate geometry: finding lengths on a graph, checking whether a triangle is isosceles, and proving that a set of points forms a square or a rectangle. The distance formula is the ruler of the coordinate plane, and almost every shape question on a graph starts with it.
In mapping and navigation, straight-line distance is the first estimate before roads are considered. Two towns 5 kilometres apart as the crow flies are never more than a short drive apart, and the straight-line number is what a radius search uses — every shop within 3 kilometres of you is found by this formula.
In games and graphics, distance decides what happens next: whether two objects have collided, whether a player is close enough to pick something up, or how loud a sound should be. Paired with the midpoint calculator, it covers the two basic measurements of any pair of points. Distance is only one of the things coordinate geometry gives you — our coordinate geometry calculator also finds the slope, midpoint and line equation.
Distance calculator vs slope and midpoint calculators
Distance, slope, and midpoint all take the same two points, but they measure different things. Distance gives the length of the segment between the points. The slope calculator gives the steepness of the line through them. The midpoint calculator gives the centre point of the segment.
Use distance when the size of the gap is what matters — how far, how long, how close. Use slope when the direction matters, and the midpoint when you need to split the segment in half or find its centre. A triangle problem often needs all three: distances for the side lengths, slope to check for right angles, midpoint to find a median.
One useful habit is to run the same points through the distance tool twice, swapping the order, and confirm the answer is identical. It always should be — distance has no direction. If swapping changes the result, a sign was dropped somewhere in the hand calculation.
Common distance mistakes
The most common mistake is adding the gaps instead of using Pythagoras: 3 + 4 = 7 is not the distance between (0, 0) and (3, 4). The straight line is always shorter than the two-step path, and the correct answer is 5. Adding the gaps only works when the points line up horizontally or vertically.
The second mistake is forgetting to square the gaps before adding them. √(3 + 4) is about 2.65, which is far too small. Square first, add second, square-root last — the order is fixed. The third mistake is taking the square root of each gap separately and adding those, which gives 3 + 4 = 7 again, the same wrong answer by a different route.
The fourth mistake is mixing up the points when subtracting, so a gap comes out with the wrong sign. It does not change the distance, because squaring removes the sign, but it does change the Δx and Δy shown on the page, so check those two rows if the distance looks right but the gaps look odd.
How to use this distance calculator
Type the first point into x1 and y1, and the second point into x2 and y2. The distance, the x-gap, and the y-gap update live as you type. Negative numbers and decimals both work, so points like (−2.5, 3) are fine.
Use the gaps as your check. If you expected the points to be 3 across and 4 up, the Δx and Δy rows should read 3 and 4. If they do not, one coordinate was typed wrong. The distance itself is hard to check by eye, so the gaps are your best friend.
Everything runs in your browser — no account, no upload, and your numbers never leave your device. Use it for homework, map measurements, or game distances, and keep the scientific calculator nearby for any hand-checking you want to do.