Distance Calculator
Calculate the straight-line distance between two points (x₁, y₁) and (x₂, y₂), plus the horizontal and vertical differences and the midpoint.
- 100% free
- No signup
- Runs in your browser
How to use
- Enter the coordinates of the first point (x₁, y₁) and of the second point (x₂, y₂). Negative numbers and decimals are allowed.
- Click Calculate or press Enter.
- Read the distance, and in the table the differences Δx and Δy, the midpoint and the squared distance.
Distance formula
| Value | Formula |
|---|---|
| Distance | d = √((x₂ − x₁)² + (y₂ − y₁)²) |
| Midpoint | ((x₁ + x₂) / 2, (y₁ + y₂) / 2) |
| Manhattan distance | |x₂ − x₁| + |y₂ − y₁| |
The distance formula comes from the Pythagorean theorem: the horizontal difference Δx = x₂ − x₁ and the vertical difference Δy = y₂ − y₁ are the legs of a right triangle, and the distance is its hypotenuse.
The midpoint is the average of the coordinates and lies exactly halfway between the two points. The Manhattan distance, the distance along a grid of streets, is shown for comparison and is never shorter than the straight-line distance.
Examples
| Example | Result |
|---|---|
| (1, 2) and (4, 6) | Δx = 3, Δy = 4, distance = 5, midpoint (2.5, 4) |
| (−3, 5) and (2, −7) | Δx = 5, Δy = −12, distance = 13 |
| (0, 0) and (1, 1) | Distance = √2 ≈ 1.414 |
Tips: Enter coordinates in the same units for both points.
FAQ
The straight-line distance is √((x₂−x₁)² + (y₂−y₁)²), the Euclidean metric in two dimensions.
Average the x-coordinates and the y-coordinates separately. The midpoint of (1, 2) and (4, 6) is (2.5, 4). The calculator shows it in the table.
No. Swapping the points changes the signs of Δx and Δy, but the distance and the midpoint stay the same.
Add the third difference under the square root: d = √(Δx² + Δy² + Δz²). This calculator works in two dimensions.
Only as a flat approximation. Real Earth distances need great-circle or projected coordinate formulas.
Any consistent length units for x and y; the distance is in the same units.