Skip to content

Distance Formula Calculator

Type the coordinates of two points, or drag them…

Type the coordinates of two points, or drag them, to get the straight-line distance between them, exactly and as a decimal.

Point 1
Point 2

ExampleDistance

6.7082

Exactly 3√5, the hypotenuse of a right triangle with legs 3 and 6.

Type your own points, or drag them.

Drag either point; it snaps to the grid every whole unit.

Δx and Δy
3 and 6
Midpoint
(5/2, 4)
Slope
2
How this works: 5 sources,

How this works

Method

The straight-line distance between two points is the hypotenuse of a right triangle whose legs are the horizontal and vertical gaps. So it is Pythagoras: d = √((x₂ − x₁)² + (y₂ − y₁)²). From (−3, 2) to (5, −4) the gaps are 8 and −6, and d = √(64 + 36) = √100 = 10. Full method

How it’s tested

2 worked examples for this page are checked by automated tests before every release: given the inputs, the tool must show the expected answer.

Privacy

On your device. Nothing you enter or open leaves this browser. About privacy labels

Changes

  • First published: 13 shapes drawn to scale with handles, exact answers in π, litres and gallons, and slope, distance, midpoint, arc and polygon pages.

Every change on What’s new

How we make toolsReport a mistake

How the distance formula works

The straight-line distance between two points is the hypotenuse of a right triangle whose legs are the horizontal and vertical gaps. So it is Pythagoras: d = √((x₂ − x₁)² + (y₂ − y₁)²). From (−3, 2) to (5, −4) the gaps are 8 and −6, and d = √(64 + 36) = √100 = 10.

The signs of the gaps don’t matter, since squaring makes them positive, and neither does the order of the points. Most distances aren’t whole numbers: from (1, 1) to (4, 7) the gaps are 3 and 6, so d = √45. The calculator simplifies the root, √45 = √(9 × 5) = 3√5, and gives the decimal, about 6.7082.

The same idea works in three dimensions with a third gap, √(Δx² + Δy² + Δz²). On a map, the formula gives the distance “as the crow flies” in the map’s units; over long distances on the Earth’s curved surface, the great-circle distance is longer than this flat answer.

d = √((x₂ − x₁)² + (y₂ − y₁)²)

Distances between pairs of points

The gaps, the sum of their squares and the distance for each pair of points, exactly and as a decimal.

The gaps, the sum of their squares and the distance for each pair of points, exactly and as a decimal.
PointsΔx, ΔyΔx² + Δy²Distance
(0, 0) to (3, 4)3, 4255
(1, 1) to (4, 7)3, 6453√5 ≈ 6.7082
(−3, 2) to (5, −4)8, −610010
(0, 0) to (1, 1)1, 12√2 ≈ 1.4142
(2, −1) to (−3, 4)−5, 5505√2 ≈ 7.0711
(0, 0) to (5, 12)5, 1216913
(−1, −1) to (2, 3)3, 4255
(3, −2) to (7, 5)4, 765√65 ≈ 8.0623
(1.5, 2) to (4, 8)5/2, 6169/413/2 ≈ 6.5
(−4, 0) to (0, 3)4, 3255
Show all 12 rows
(0, 0) to (8, 15)8, 1528917
(2, 3) to (2, 9)0, 6366

Common questions

Is the distance formula the same as Pythagoras?

Yes, applied to coordinates. The horizontal and vertical gaps are the two legs and the distance is the hypotenuse.

Can a distance be negative?

No. The gaps can be negative, but they are squared, and the square root is taken as positive. A distance of 0 means the two points are the same.

How do I find the distance from a point to a line?

That is a different formula: for the line ax + by + c = 0 and the point (x₀, y₀), it is |ax₀ + by₀ + c| ÷ √(a² + b²), the length of the perpendicular from the point to the line.