Skip to main content

Distance Formula Calculator

Blake Boege
Written by Blake Boege · Founder, Calculator Answers

A distance formula calculator is a geometric tool used to find the Euclidean distance between two coordinate pairs on a Cartesian plane. It applies the Pythagorean theorem-based distance formula to compute the straight-line distance using the horizontal and vertical differences between the points. The tool delivers the final value in simplified radical form for mathematical precision, as well as decimal approximations for practical measurement. Students, land surveyors, and designers use it to map coordinates and verify dimensions.

Enter the coordinates of two points and we compute the straight-line distance between them. The result shows the horizontal and vertical changes, the squared differences, and the final distance, with the exact radical form when it lands on one.

Quick Answer

Calculate the straight-line distance between two points in a two-dimensional coordinate plane. Enter the coordinates of both points to see decimal and exact radical answers.

Coordinates

Enter two points (x₁, y₁) and (x₂, y₂).

e.g. 1

e.g. 2

e.g. 4

e.g. 6

Step by step

  1. 1. Identify the coordinates. x₁ = 1, y₁ = 2, x₂ = 4, y₂ = 6.
  2. 2. Subtract x coordinates. Δx = 41 = 3.
  3. 3. Subtract y coordinates. Δy = 62 = 4.
  4. 4. Square both differences. Δx² = 9, Δy² = 16.
  5. 5. Add the squared differences. 9 + 16 = 25.
  6. 6. Take the square root. d = √25 = 5.
Distance

d =

5

From (1, 2) to (4, 6)

Point 1(1, 2)
Point 2(4, 6)
Δx (x₂ − x₁)3
Δy (y₂ − y₁)4
Δx² + Δy²25
d (distance)5

The distance formula d = √((x₂ − x₁)² + (y₂ − y₁)²) is the Pythagorean theorem applied to the right triangle whose legs are the horizontal and vertical changes between the two points.

Was this helpful?

Examples

(1, 2) and (4, 6)

d = 5

(0, 0) and (3, 4)

d = 5

(−2, 3) and (4, −5)

d = 10

(0, 0) and (1, 1)

d = √2 ≈ 1.4142

How it works

Formula · d = sqrt((x2 - x1)^2 + (y2 - y1)^2). This is c = sqrt(a^2 + b^2) with the two legs written as coordinate differences.

For any two points (x₁, y₁) and (x₂, y₂) on a coordinate plane, the distance between them is:

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

The horizontal change x₂ − x₁ and the vertical change y₂ − y₁ are the two legs of a right triangle whose hypotenuse is the distance you want. That is why this formula is just the Pythagorean theorem applied to coordinates.

What is the distance formula?

The distance formula is an algebraic tool used to find the shortest, straight-line distance between two points in a two-dimensional Cartesian coordinate system. It translates geometric length into numerical form using the coordinates of the endpoints.

How to find the distance between two points step-by-step

To calculate the distance between Point 1 (x₁, y₁) and Point 2 (x₂, y₂):

  1. Subtract x₁ from x₂ to find the horizontal distance (the "run").
  2. Subtract y₁ from y₂ to find the vertical distance (the "rise").
  3. Square both differences separately to make them positive numbers.
  4. Add the two squared values together.
  5. Take the square root of that sum to find the final distance.

The distance formula is the Pythagorean theorem

Not a resemblance, and not an application of a related idea. The two are the same statement written in different notation. Plot any two points, draw a horizontal line from one and a vertical line from the other, and they meet at a right angle. The horizontal leg is |x₂ − x₁|, the vertical leg is |y₂ − y₁|, and the straight line between your two points is the hypotenuse. Solving a² + b² = c² for c gives the distance formula, character for character. Anyone who can do one can already do the other.

xy01426(1, 2)(4, 6)3453² + 4² = 25, so d = √25 = 5

The diagram shows a coordinate plane with the x-axis and y-axis drawn. Two points are marked, (1, 2) and (4, 6). A dashed horizontal leg runs from the first point across to x equals 4, a length of 3. A dashed vertical leg runs up from there to y equals 6, a length of 4. A small square marks the right angle where the two legs meet. The solid line joining the two points is the hypotenuse of that triangle. Because 3 squared plus 4 squared is 25, the distance is the square root of 25, which is 5.

Working a distance out by hand

The same pair of points, done longhand. The order of the two points never matters, because both differences get squared and squaring destroys the sign.

  1. Take the horizontal difference. 4 − 1 = 3.
  2. Take the vertical difference. 6 − 2 = 4.
  3. Square both and add them. 3² = 9, 4² = 16, and 9 + 16 = 25.
  4. Take the square root. √25 = 5, so the distance is exactly 5 units.

A whole number came out only because the legs were 3 and 4, one of the rare pairs that produces one. Most coordinate pairs do not, which is why the calculator also reports the exact radical form alongside the decimal.

Edge cases, and what the answer means

  • The same point twice. Both differences are zero, so the distance is zero. That is a real answer, not an error.
  • Negative coordinates. They work exactly like positive ones. From (−2, −3) to (1, 1) the differences are 3 and 4 again, giving 5 again. The common slip is dropping a minus sign while subtracting, not the squaring.
  • Exact versus decimal. When the sum of squares is a whole number, the calculator shows the simplified radical as well as the decimal. From (0, 0) to (2, 3) the sum is 13, which has no square factor, so the exact answer stays √13 and the decimal 3.6056 is a rounding of it. From (0, 0) to (2, 2) the sum is 8, which does factor, so the exact answer tidies to 2√2.
  • Two dimensions only. This calculator works in the plane. A third coordinate would need a third squared difference under the same root, and this tool does not accept one.

If what you actually have is a triangle rather than a pair of points, the right triangle calculator solves the whole shape, angles included, from any two known parts. This page answers one narrower question: how far apart two coordinates are.

Your coordinates stay in the page

Every coordinate you enter is processed by this page in your browser. The points and the distance are not sent to a server, not stored after you close the tab, and not visible to anyone else. There is no account and nothing to sign up for.

Worked example: Finding distance with negative coordinates

Let's find the distance between the points (−2, 3) and (4, −5):

  • Label coordinates: x₁ = -2, y₁ = 3, x₂ = 4, y₂ = -5
  • Find horizontal change: x₂ − x₁ = 4 − (−2) = 6
  • Find vertical change: y₂ − y₁ = −5 − 3 = −8
  • Square the changes: 6² = 36, and (−8)² = 64
  • Sum the squares: 36 + 64 = 100
  • Take the square root: √100 = 10

The distance between the two points is exactly 10.

Common mistakes when using the distance formula

  • Incorrect handling of negative signs: Forgetting that subtracting a negative number results in addition, for instance writing 4 − (−2) as 4 − 2 = 2 instead of 4 + 2 = 6.
  • Mixing up coordinates: Matching an x-coordinate with a y-coordinate during subtraction (e.g. computing x₂ − y₁ instead of x₂ − x₁).
  • Forgetting the square root: Adding the squared differences and leaving the sum as the final answer without applying the final square root step.
  • Adding before squaring: Summing the differences and then squaring the result, which yields the incorrect math (x₂ - x₁ + y₂ - y₁)².

Frequently asked questions

Use this page when you have two coordinates and want the straight-line distance between them. Use the right triangle calculator when you have side lengths or an angle and want the rest of the triangle, including its angles, area and perimeter. This page returns one number; that one solves the whole shape.

No. It works in the plane, with x and y only. Extending to three dimensions means adding a third squared difference under the same square root, d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²), and this tool does not accept a z coordinate.

No. Both differences are squared before they are added, and squaring a negative gives the same result as squaring its positive. Going from (1, 2) to (4, 6) gives differences of 3 and 4; going the other way gives −3 and −4, and both square to 9 and 16. The distance is 5 either way.

Because the square root is usually the exact answer and the decimal is a rounding of it. From (0, 0) to (2, 3) the sum of squares is 13, which has no square factor, so √13 cannot be simplified and 3.6056 is only an approximation. Where the sum does have a square factor the exact form is tidied: a sum of 8 becomes 2√2. Classwork often wants the radical rather than the decimal.

That both coordinates are identical, so the two points are the same point. The horizontal and vertical differences are both zero, and the square root of zero is zero. It is a correct answer rather than an error condition.

Not at all. Subtracting a negative is the only place people usually slip. From (−2, −3) to (1, 1), the horizontal difference is 1 − (−2) = 3 and the vertical difference is 1 − (−3) = 4, so the distance is 5. Once the differences are squared, every sign disappears.

It is the Pythagorean theorem, not merely similar to it. Two points and the horizontal and vertical lines between them form a right triangle. The legs are the differences in x and in y, and the straight line joining the points is the hypotenuse. Solving a² + b² = c² for c produces the distance formula exactly.

The distance formula is d = √((x₂ − x₁)² + (y₂ − y₁)²). It returns the straight-line distance between two points (x₁, y₁) and (x₂, y₂) in a 2D coordinate plane. The formula comes directly from the Pythagorean theorem applied to the right triangle formed by the horizontal and vertical changes between the points.

Subtract the x-coordinates to get the horizontal change. Subtract the y-coordinates to get the vertical change. Square both differences, add the squares together, and take the square root. The result is the distance.

(x₁, y₁) and (x₂, y₂) are the two points you want to measure between. The numbered subscripts just label which point is which. The formula gives the same answer regardless of which point you call point 1 and which you call point 2, because the differences get squared.

No. Distance is always zero or positive. The formula squares the differences before taking the square root, which removes any negative sign. A distance of zero only happens when both points are the same.

Yes. Negative coordinates are fine on either or both points. The formula computes (x₂ − x₁) and (y₂ − y₁) correctly regardless of sign, and the squaring step handles the rest.

Yes. The distance formula is the Pythagorean theorem in disguise. The horizontal change (x₂ − x₁) and vertical change (y₂ − y₁) form the two legs of a right triangle, and the distance between the points is the hypotenuse. So d² = (x₂ − x₁)² + (y₂ − y₁)² is just a² + b² = c² with different labels.

Yes. The four coordinate fields accept decimals and negative numbers. The result is computed in full floating-point precision; the displayed value is rounded for readability, and when the answer is a clean integer or has a simple radical form, that exact form is shown alongside the decimal.

For three dimensions, you add the squared difference of the z-coordinates under the square root: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²). This extension of the distance formula works for any number of dimensions.