Skip to content
CalcSpectrum

Distance Calculator

Calculate the straight-line distance between two points on a 2D plane using the Pythagorean theorem. Enter the x and y coordinates of both points to get the exact distance.

Free to use · Instant results
Loading calculator…

How It's Calculated

Formula

d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}

The distance between two points on a 2D plane is a direct application of the Pythagorean theorem. Picture the two points connected by a straight line, then draw a right triangle underneath it: one leg runs horizontally (the difference between the x-coordinates), the other runs vertically (the difference between the y-coordinates), and the straight-line distance is the triangle's hypotenuse. That means distance = sqrt((x2 - x1)^2 + (y2 - y1)^2) is exactly a^2 + b^2 = c^2 solved for c, with a = the horizontal difference and b = the vertical difference. Enter the coordinates of both points — any real numbers, positive or negative — and this calculator returns the straight-line distance between them.

Worked Examples

Classic 3-4-5 case: (0, 0) to (3, 4)

  1. Find the horizontal difference: x2 - x1 = 3 - 0 = 3
  2. Find the vertical difference: y2 - y1 = 4 - 0 = 4
  3. Apply the Pythagorean theorem: d = sqrt(3^2 + 4^2) = sqrt(9 + 16) = sqrt(25)
  4. d = 5

Negative coordinates: (-3, -4) to (0, 0)

  1. Find the horizontal difference: x2 - x1 = 0 - (-3) = 3
  2. Find the vertical difference: y2 - y1 = 0 - (-4) = 4
  3. Apply the Pythagorean theorem: d = sqrt(3^2 + 4^2) = sqrt(9 + 16) = sqrt(25)
  4. d = 5

Frequently Asked Questions

Does the order of the two points matter?

No. Swapping Point 1 and Point 2 flips the sign of each difference (x2 - x1 becomes x1 - x2), but both differences get squared in the formula, so the result is identical either way.

Can the coordinates be negative?

Yes. Coordinates can be any real number — positive, negative, zero, or fractional. There's no requirement that points sit in a particular quadrant; the formula works the same everywhere on the plane.

What if both points are the same?

The distance is 0. Both the horizontal and vertical differences are 0, so sqrt(0^2 + 0^2) = 0 — a valid result, not an error.

Does this work for points in 3D space or on a globe?

Not this calculator. This is a 2D Cartesian (flat-plane) distance calculator. Distance between points in 3D space, or between two locations on the Earth's curved surface (geodesic distance), requires a different formula and a different tool.

How is this related to the Pythagorean theorem?

Directly. The horizontal and vertical differences between the two points form the two legs of a right triangle, and the straight-line distance between the points is that triangle's hypotenuse — so this calculator's formula is simply a^2 + b^2 = c^2 solved for c.