Distance Between Two Points Calculator
The distance between two points on a plane is d = √[(x₂ − x₁)² + (y₂ − y₁)²]. Between (1, 2) and (7, 10), the horizontal difference is 6 and the vertical difference is 8, so the distance is 10.
Last updated · By S. Dilshan · Runs in your browser, nothing is uploaded
Step-by-Step Solution
What Is the Distance Formula?
The distance formula gives the straight-line length between two points on a coordinate plane. It is the Pythagorean theorem in disguise: the horizontal difference Δx and the vertical difference Δy form the two legs of a right triangle, and the distance between the points is the hypotenuse.
Because the formula works from coordinates alone, it is used wherever positions are described by numbers: maps and GPS grids, computer graphics, game development, robotics, surveying and data science, where the “distance” between data points is a measure of how similar they are.
Straight Line vs Walking Distance
| Measure | Formula | For (1, 2) to (7, 10) |
|---|---|---|
| Euclidean (straight line) | √(Δx² + Δy²) | 10 |
| Manhattan (city blocks) | |Δx| + |Δy| | 14 |
| Horizontal difference Δx | x₂ − x₁ | 6 |
| Vertical difference Δy | y₂ − y₁ | 8 |
Someone walking along a street grid must cover 6 blocks east and 8 blocks north, 14 in all, even though a bird flies the 10-unit straight line.
Distance Formula
(x₁, y₁)and(x₂, y₂)are the coordinates of the two points.- Subtracting the coordinates in either order gives the same distance, because the differences are squared.
- The result is in the same unit as the coordinates.
- In three dimensions, add a third term (z₂ − z₁)². See the 3D distance calculator.
The underlying relationship is explained in the Pythagorean theorem calculator. To find the halfway point, use the midpoint calculator.
How Is It Calculated? Worked Examples
(1, 2) to (7, 10)
- Δx = 7 − 1 = 6.
- Δy = 10 − 2 = 8.
- d = √(36 + 64) = √100 = 10.
(0, 0) to (3, 4)
The classic 3-4-5 triangle: d = √(9 + 16) = 5.
With Negative Coordinates: (−4, 6) to (10, −2)
Δx = 14 and Δy = −8, so d = √(196 + 64) = √260 ≈ 16.12. The negative sign disappears when squared.
Perimeter of a Triangle
The triangle with vertices (0, 0), (4, 0) and (0, 3) has sides of 4, 3 and √(16 + 9) = 5, so its perimeter is 12.
Checking Whether Points Lie on a Circle
A point is on a circle of radius 5 centred at (3, −2) if its distance from the centre is 5. The point (6, 2) is √(9 + 16) = 5 away, so it is on the circle. See the circle equation calculator.
Nearest Neighbour
To find which of three points is closest to the query point (3, 3), compute each distance: to A (1, 1) it is √8 = 2.83, to B (4, 5) it is √5 = 2.24 and to C (2, 2) it is √2 = 1.41. Point C is nearest. This is the idea behind k-nearest-neighbour methods in machine learning.
Overlapping Circles
Two circles with radii 2 and 3 overlap if the distance between their centres is less than 2 + 3 = 5. With centres 4.5 apart they overlap, and with centres 5.5 apart they do not. Games use this test for collision detection.
Distance on the Earth
On a map grid in metres the formula is exact, but latitude and longitude are angles. Roughly, one degree of latitude is about 111 km, so two points 0.1° apart in latitude are about 11.1 km apart. For long distances, use the great-circle (haversine) formula instead.
How to Use This Distance Calculator
- Enter the coordinates of the first point, x₁ and y₁.
- Enter the coordinates of the second point, x₂ and y₂.
- Read the distance, plus Δx and Δy.
- Open the steps to see the squares and the square root.
Where the Distance Formula Is Used
- Maps and navigation: straight-line distance between two positions on a flat grid.
- Computer graphics and games: collision detection and range checks between objects.
- Surveying and engineering: lengths of boundaries and structural members.
- Data science and machine learning: k-nearest-neighbour and clustering use distance between data points.
- Robotics: measuring how far a robot is from a target.
What Are the Most Common Mistakes With the Distance Between Two Points Calculator?
- Forgetting to square the differences or to take the square root at the end.
- Adding the coordinates instead of subtracting. You need the differences.
- Sign errors with negatives. Subtracting −4 is the same as adding 4.
- Using it for curved surfaces. On the Earth’s surface, the straight-line formula on latitude and longitude is only a rough approximation over short distances.
- Mixing units on the two axes. Both axes must use the same unit.
- Confusing Euclidean and Manhattan distance. They answer different questions.
Where Can You Verify These Formulas?
The definitions and formulas on this page follow standard references. Check them against these sources:
Built and maintained by S. Dilshan. Found a mistake? Email [email protected] with the page address.
Frequently Asked Questions
What is the distance formula?
d = √[(x₂ − x₁)² + (y₂ − y₁)²], the straight-line distance between two points on a plane.
How is the distance formula related to the Pythagorean theorem?
The horizontal and vertical differences are the legs of a right triangle, and the distance is its hypotenuse.
Does the order of the points matter?
No. Squaring the differences removes any negative signs, so the distance is the same either way round.
What is the distance between (1, 2) and (7, 10)?
10 units, since Δx = 6, Δy = 8 and √(36 + 64) = 10.
What is Manhattan distance?
The distance along a grid: |Δx| + |Δy|. For the default points it is 14, compared with the straight-line 10.
How do I find distance in three dimensions?
Add a third term: d = √(Δx² + Δy² + Δz²).