Distance Formula Calculator

Find the exact and decimal distance between two points in a 2D coordinate plane or 3D space, with every formula step shown.

2D and 3D coordinatesExact radical formStep-by-step solution

Calculate Distance Between Two Points

Enter Cartesian coordinates. Negative values and decimals are supported.

Point 1
Point 2

How the Distance Formula Works

The Euclidean distance formula is the Pythagorean theorem applied to coordinates. The horizontal and vertical changes form the legs of a right triangle, while the line joining the points is its hypotenuse.

1

Subtract coordinates

Find the signed horizontal, vertical, and—when needed—depth changes between the endpoints.

Δx = x₂ − x₁, Δy = y₂ − y₁, Δz = z₂ − z₁
2

Square and add

Square each coordinate difference so every contribution is nonnegative, then add them.

d² = Δx² + Δy² (+ Δz²)
3

Take the square root

The positive square root of the squared distance is the straight-line distance.

d = √d²

2D distance formula

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

3D distance formula

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

Distance Formula Example With Negative Coordinates

Find the distance between (−2, −3) and (−4, 4). Keeping the subtraction order consistent gives Δx = −2 and Δy = 7. Squaring removes the signs.

Coordinate changes
Δx = −2, Δy = 7
Square each change
(−2)² = 4, 7² = 49
Add the squares
d² = 4 + 49 = 53
Take the root
d = √53 ≈ 7.28

The exact answer is √53 units and the decimal approximation is 7.28 units. Reversing the two points changes the signs of both coordinate differences, but their squares—and therefore the distance—remain the same.

Distance Between Two Points Guide

Distance formula on a coordinate plane

Label the first point (x₁, y₁) and the second (x₂, y₂). The subscripts identify matching coordinates; they are not exponents. Substitute each ordered pair without mixing x- and y-values.

Distance from the origin

When one endpoint is (0, 0), the formula simplifies to √(x² + y²). This is also the magnitude of the position vector from the origin to the point.

Exact radical vs. decimal distance

An exact radical such as √53 preserves the full mathematical value. A decimal such as 7.28 is rounded for measurement or comparison. This tool shows both when integer coordinates permit it.

Three-dimensional coordinate distance

Add the squared z-coordinate difference for 3D space. The result is the straight-line length between two positions in a Cartesian x-y-z system.

Common Distance Formula Mistakes

Using the midpoint formula

A midpoint is a coordinate, while distance is a nonnegative length. Averaging coordinates does not measure how far apart the points are.

Losing negative signs

Put negative coordinates in parentheses before subtracting, then square the complete difference.

Inconsistent subtraction

Use x₂ − x₁ and y₂ − y₁ together. Do not reverse just one coordinate difference.

Rounding too early

Keep the exact square root through the intermediate steps and round only the final decimal result.

Where Coordinate Distance Is Used

Coordinate geometry

Measure line segments, triangle sides, diagonals, radii, and distances from the origin.

Games and graphics

Check object proximity, collision ranges, camera movement, and 2D or 3D vector lengths.

Engineering and physics

Measure displacement between positions represented in Cartesian coordinate systems.

Data science

Euclidean distance can compare numeric observations in clustering and nearest-neighbor methods after appropriate scaling.

Distance Formula FAQ

What is the distance formula?

For points (x₁, y₁) and (x₂, y₂), the 2D distance formula is d = √((x₂ − x₁)² + (y₂ − y₁)²). It measures straight-line Euclidean distance on a coordinate plane.

How do you find the distance between two points?

Subtract corresponding coordinates, square each difference, add the squares, and take the square root. This calculator performs those steps and displays both an exact radical and decimal approximation when possible.

Why does the distance formula use the Pythagorean theorem?

The horizontal and vertical coordinate changes form perpendicular legs of a right triangle. The segment joining the points is the hypotenuse, so its length follows a² + b² = c².

Does the order of the points matter in the distance formula?

No. Reversing the points changes the sign of every coordinate difference, but squaring removes those signs. Keep the subtraction order consistent within a calculation to avoid mistakes.

How do I calculate distance with negative coordinates?

Substitute negative coordinates with parentheses, then subtract carefully. A negative difference is valid because its square is positive. For example, (−6)² equals 36, not −36.

What is the 3D distance formula?

For (x₁, y₁, z₁) and (x₂, y₂, z₂), use d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²). It extends the same Pythagorean idea into three dimensions.

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

Use the origin as the first point. In 2D, the distance from (0, 0) to (x, y) is √(x² + y²). In 3D, add z² inside the square root.

What is Euclidean distance?

Euclidean distance is the ordinary straight-line distance between points. The coordinate distance formula calculates this metric in 2D, 3D, or higher-dimensional Cartesian spaces.

What is the difference between distance and midpoint formulas?

The distance formula returns one nonnegative length. The midpoint formula averages corresponding coordinates and returns the point halfway between the endpoints.

Can the distance between two points be zero?

Yes. The distance is zero only when every corresponding coordinate is equal, meaning both entries describe the same point.

What units does the distance formula answer use?

The answer uses the same unit represented by the coordinate axes. If the coordinates are measured in meters, the distance is in meters; if no measurement unit is specified, report the answer in coordinate units.

Does this calculator find driving or geographic distance?

No. It calculates straight-line Cartesian distance. Latitude and longitude require a spherical or ellipsoidal Earth formula, while driving distance requires a road-routing service.

Useful tools selected for this workflow