Distance Between Two Points Calculator

Enter (x₁, y₁) and (x₂, y₂) to calculate the straight-line Euclidean distance between two points in a 2D Cartesian plane.

By the Starlight Tools Editorial Team · Last updated

Enter two points

Use integers, decimals, fractions such as 3/4, or mixed numbers such as -1 1/2. Both axes must use the same unit.

Quick examples
Point 1
Point 2

Valid changes recalculate automatically. You can also press Enter in any coordinate field.

Coordinate graph

Enter two complete points to plot them. The graph uses equal scale on both axes.

Advertisement

Distance formula and variables

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

The coordinate differences form the two legs of a right triangle. The distance d is its hypotenuse, so the formula follows from the Pythagorean theorem.

x₁, y₁
the horizontal and vertical coordinates of Point 1
x₂, y₂
the horizontal and vertical coordinates of Point 2
Δx
the horizontal change, x₂ − x₁
Δy
the vertical change, y₂ − y₁
d
the nonnegative straight-line distance

The answer is in coordinate units unless the axes represent a named physical unit. For example, coordinates measured in metres produce a distance in metres.

Worked examples

1. A 3–4–5 triangle

From (0, 0) to (3, 4):

d = √((3 − 0)² + (4 − 0)²)
= √(9 + 16) = √25 = 5

If the coordinates are in metres, the distance is 5 metres.

2. Points spanning negative coordinates

From (−3, −1) to (3, 2):

d = √((3 − (−3))² + (2 − (−1))²)
= √(36 + 9) = √45 = 3√5 ≈ 6.7082

The distance is about 6.7082 coordinate units.

3. Fractional coordinates

From (1/2, 1/4) to (5/2, 13/4):

d = √((5/2 − 1/2)² + (13/4 − 1/4)²)
= √(2² + 3²) = √13 ≈ 3.6056

The distance is about 3.6056 coordinate units.

Common questions and edge cases

Why can distance not be negative?

The coordinate differences are squared, so their sum is nonnegative. The distance is the nonnegative square root of that sum.

Does the order of the points matter?

No. Swapping the points changes the signs of Δx and Δy, but their squares—and therefore the distance—stay the same.

How do I find distance from the origin?

Use (0, 0) as one point. The formula simplifies to d = √(x² + y²).

What if the points are identical?

Both coordinate differences are zero, so the distance is √0 = 0. The graph shows a single shared location.

Can I use fractions, negative numbers, or decimals?

Yes. Each coordinate accepts integers, decimals, fractions such as 3/4 or -5/2, and simple mixed numbers such as 1 1/2.

Do both axes need to use the same unit?

Yes. Both axes must use the same scale and unit for the result to be meaningful. The answer uses that same unit.

Can I use this formula for road routes or latitude and longitude?

Not directly. This formula measures a straight line on a flat Cartesian plane. Road routes require network data, while latitude/longitude normally requires a spherical or ellipsoidal Earth-distance method.

Calculation method and references

Editorial owner: Starlight Tools Editorial Team. The calculator applies the Euclidean formula in the browser and has been checked with positive, negative, decimal, fractional, identical-point, horizontal-line, and vertical-line cases. Inputs are not uploaded.

Reference: OpenStax, “The Rectangular Coordinate Systems and Graphs”, derives the coordinate distance formula from the Pythagorean theorem.

Explore more tools