Enter the Point Coordinates

Calculate the Euclidean distance between two Cartesian points in 2D or 3D.

Use integers, decimals or fractions such as -3, 2.5 or 3/4.

Point A (x₁, y₁)

Point B (xā‚‚, yā‚‚)

Distance

No result yet
Enter points and press Calculate

Formula (2D): √[(xā‚‚āˆ’x₁)² + (yā‚‚āˆ’y₁)²] — 3D adds (zā‚‚āˆ’z₁)².

Note: This calculator uses Euclidean distance. Decimal approximations are shown to up to 6 places; exact values are preserved where possible.

The distance between two points is the length of the straight line segment connecting their Cartesian coordinates. Enter two ordered pairs above to calculate the Euclidean distance, see the coordinates substituted into the formula and check the answer on a coordinate graph.

This calculator supports positive values, negative values, decimals and fractions in both 2D and 3D. Coordinate values are treated as abstract units; the tool does not calculate road routes or distances across the curved surface of the Earth.

How to Use the Distance Calculator

  1. Enter the x- and y-coordinates for Point A and Point B.
  2. If both points include a z-coordinate, select Enable 3D and enter z₁ and zā‚‚.
  3. Select Calculate or press Enter to see the exact value, decimal approximation and complete working.
  4. Use Copy to copy the full solution, or Reset to start again.

Distance Between Two Points Formula

For Point A (x₁, y₁) and Point B (xā‚‚, yā‚‚) in a two-dimensional Cartesian plane, the distance formula is:

d = √[(xā‚‚ āˆ’ x₁)² + (yā‚‚ āˆ’ y₁)²]

First find the horizontal difference Ī”x = xā‚‚ āˆ’ x₁ and vertical difference Ī”y = yā‚‚ āˆ’ y₁. Square both differences, add them and take the square root. Squaring removes the direction sign, so the final distance is always zero or positive.

Why the Formula Works

The coordinate differences form the two perpendicular legs of a right triangle. The segment joining the points is the hypotenuse. Applying the Pythagorean theorem gives d² = Ī”x² + Ī”y², and taking the square root gives the distance. You can explore this relationship further with the Pythagorean Theorem Calculator.

Worked Examples

Example 1: Positive Coordinates

Find the distance between A(1, 2) and B(4, 6).

d = √[(4 āˆ’ 1)² + (6 āˆ’ 2)²]

d = √[3² + 4²] = √[9 + 16] = √25 = 5

The two points are 5 units apart.

Example 2: Negative Coordinates

Find the distance between A(āˆ’2, 4) and B(4, āˆ’6).

d = √[(4 āˆ’ (āˆ’2))² + (āˆ’6 āˆ’ 4)²]

d = √[6² + (āˆ’10)²] = √136 = 2√34

The exact distance is 2√34 units, or approximately 11.661904 units.

Example 3: Distance in 3D

Find the distance between A(1, 2, 3) and B(4, 6, 3).

d = √[(4 āˆ’ 1)² + (6 āˆ’ 2)² + (3 āˆ’ 3)²]

d = √[3² + 4² + 0²] = √25 = 5

The two points are 5 units apart.

2D and 3D Distance

Coordinate spaceFormula
2D: (x, y)d = √[(xā‚‚āˆ’x₁)² + (yā‚‚āˆ’y₁)²]
3D: (x, y, z)d = √[(xā‚‚āˆ’x₁)² + (yā‚‚āˆ’y₁)² + (zā‚‚āˆ’z₁)²]

The 3D formula adds the squared difference between the z-coordinates. It is useful for points in 3D models, game spaces, engineering drawings and other Cartesian coordinate systems with width, height and depth.

Exact and Decimal Answers

An exact answer keeps a square root when it cannot be simplified to a rational number. For example, √136 = 2√34 is exact, while 11.661904 is a rounded decimal approximation. Keeping the exact form prevents rounding errors during later calculations.

Fractions: Enter a fraction with a slash, such as 3/4, or a mixed number such as 1 1/2. The calculator validates the denominator and preserves the exact squared-distance expression.

Distance vs. Midpoint

Distance tells you how far apart two points are, while the midpoint gives the coordinate exactly halfway between them. For points (x₁, y₁) and (xā‚‚, yā‚‚), the midpoint is ((x₁ + xā‚‚) Ć· 2, (y₁ + yā‚‚) Ć· 2). In 3D, the z-coordinates are averaged in the same way.

The calculator displays both values so you can analyze the same line segment without entering the coordinates again.

Common Distance Formula Mistakes

  • Mixing coordinate types: subtract x from x, y from y and z from z.
  • Dropping a negative sign: use parentheses when substituting a negative value, such as 4 āˆ’ (āˆ’2).
  • Forgetting to square: the formula adds squared coordinate differences, not the raw differences.
  • Forgetting the square root: Ī”x² + Ī”y² is the squared distance, not the final distance.
  • Rounding too early: keep exact values through the working and round only the final decimal approximation.
  • Using geographic coordinates: latitude and longitude over the Earth require a geodesic formula, not this flat Cartesian formula.

How to Verify the Answer

  • Reverse Point A and Point B. The distance should remain unchanged.
  • Square the final distance and check that it equals the sum of the squared coordinate differences.
  • Confirm the distance is non-negative and visually reasonable on the graph.

Frequently Asked Questions

How we calculate: The calculator subtracts corresponding coordinates, squares each difference, adds the squared values and takes the square root. Exact rational arithmetic is preserved for supported inputs, while the decimal result is calculated separately with Math.hypot() for numerical stability.

Last reviewed: July 22, 2026

Enter another pair of coordinates above, copy the complete solution or use the Pythagorean Theorem Calculator to explore the right-triangle relationship behind the formula.