Distance Calculator

  • Tested against OpenStax's examples and 120 cases worked with exact fractions by an independent program
  • Checked by Wayne Bickerton
  • Sources: OpenStax
  • Updated November 9, 2026

The distance between two points is the length of the straight line joining them, worked out with the distance formula. Type the coordinates of two points on a graph, in 2D or 3D, and you get the distance at once, exactly (as a square root like √41) and as a decimal, with the steps. It measures between coordinates, as the crow flies, not the driving distance between places on a map.

First point
Second point
Distance
6.4031 Exactly √41

The distance from (−3, −1) to (2, 3) is √41, which is 6.4031.

Change in x 5
Change in y 4
Distance squared 41

What is the distance formula?

The distance formula gives the length of the straight line between two points (x₁, y₁) and (x₂, y₂): d = √((x₂ − x₁)² + (y₂ − y₁)²). It comes from the Pythagorean theorem: the change in x and the change in y are the two shorter sides of a right triangle, and the distance is its longest side.

It doesn’t matter which point you call the first: the differences are squared, so the answer is the same both ways. The answer is in whatever unit the coordinates use.

Source OpenStax · College Algebra 2e, 2.1 The Rectangular Coordinate Systems and Graphs ↗

How to find the distance between two points

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

Here it is with your numbers:

  1. d = √((2 − (−3))² + (3 − (−1))²)
  2. d = √(5² + 4²)
  3. d = √(25 + 16)
  4. d = √41
  5. d = 6.4031

It means a straight line from (−3, −1) to (2, 3) is 6.4031 units long, measured in the same units as the coordinates.

Take the second point’s x away from the first point’s x, and the same for y, square both, add them, then take the square root. When the number under the root isn’t a perfect square, the exact answer stays a square root, simplified where it can be: √50 is 5√2.

Distance between two points in 3D

In space each point has a third coordinate, z, and the formula gains one more square: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²). From (3, −1, 5) to (2, 1, −1) is √(1 + 4 + 36), which is √41, or 6.4031. Choose “In space (3D)” above to add the z boxes.

Source OpenStax · Calculus Volume 3, 2.2 Vectors in Three Dimensions ↗

Distance examples

Tap a row to try it.

FromToExactlyDistance
(0, 0)(3, 4)55
(−3, −1)(2, 3)√416.4031
(0, 0)(8, 7)√11310.6301
(1, 2)(7, 10)1010
(3, −1, 5)(2, 1, −1)√416.4031
(1, −5, 4)(4, −1, −1)5√27.0711

A walk of 8 blocks east and 7 blocks north is 15 blocks on the streets, but only √113, or 10.6301 blocks, in a straight line.

FAQs

How do you calculate distance?

Between two points on a graph, use the distance formula, d = √((x₂ − x₁)² + (y₂ − y₁)²). From (−3, −1) to (2, 3) the changes are 5 and 4, so d = √(25 + 16), which is √41, or 6.4031.

Source OpenStax · College Algebra 2e, 2.1 The Rectangular Coordinate Systems and Graphs ↗

Why does the distance formula work?

It is the Pythagorean theorem, a² + b² = c². The change in x and the change in y are the two shorter sides of a right triangle, and the distance between the points is its longest side.

Sources

Related calculators