Math Calculators

Distance Calculator

Use this distance calculator to find the straight-line distance between two points on a 2D plane or in 3D space, using the distance formula (Pythagoras' theorem applied to coordinates). Enter the coordinates and get the distance instantly.

Primary answer
Distance
Inputs to verify
First point x, First point y, and Second point x
Use type
Use as a direct calculation check.
Keyword intent
distance calculator

Calculator

Distance Calculator

Calculates distance from first point x, first point y, second point x. Defaults are filled in so you can review a working example before changing inputs.

X-coordinate of the first point.

Y-coordinate of the first point.

X-coordinate of the second point.

Y-coordinate of the second point.

Result

Result reflects the current submitted inputs.

  • Risk A
  • Reviewed 2026-05-26
  • 1 sources
Distance5 units
Horizontal change3 units
Vertical change4 units
Squared distance25 square units
  • Coordinates are interpreted as Cartesian points in the same unit system.
  • The result is straight-line planar distance, not travel or geographic surface distance.
  • Intermediate values are not rounded; raw outputs are rounded to 10 decimal places for stability.

Accuracy notes

Risk level
A
Reviewed
2026-05-26
Sources
1
Primary result
Distance

Formula logic is kept in a pure calculator module with fixtures, source notes, and page-visible assumptions.

What the result means

The result is the straight-line (Euclidean) distance, the shortest path between the points. It is independent of order: distance from A to B equals distance from B to A.

DistanceDisplayed as decimal in units.
Horizontal changeDisplayed as decimal in units.
Vertical changeDisplayed as decimal in units.
Squared distanceDisplayed as decimal in square units.

Use the result this way

  1. Start with Distance, then use supporting outputs for context.
  2. Verify First point x, First point y, and Second point x before copying the result.
  3. Check the formula, example, and assumptions before reusing the answer.

User job

How to use this calculator

Use Distance Calculator when you need distance, then use horizontal change and vertical change to check the context for quick number work, classwork, spreadsheet checks, and explaining a calculation to someone else.

Best for

  • Checking the core numeric relationship
  • Comparing the main result with supporting outputs
  • Reviewing a default example before entering your own first point x and first point y.

Check before relying

  • Confirm sign, decimal, percent, and rounding assumptions before copying the number.
  • Coordinates are interpreted as Cartesian points in the same unit system.
  • The result is straight-line planar distance, not travel or geographic surface distance.
  • Source context: OpenStax, reviewed 2026-06-18.

Next useful step

Formula

2D distance: d = sqrt((x2 - x1)^2 + (y2 - y1)^2). 3D distance: d = sqrt((x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2). This is the Pythagorean theorem applied to coordinate differences. The result is always non-negative.

  • The distance formula comes from the Pythagorean theorem: the segment between two points is the hypotenuse of a right triangle with legs (x2-x1) and (y2-y1).
  • In 3D, add the z difference squared inside the square root.
  • Distance is always non-negative; the squaring step removes any sign.
  • For points on Earth (latitude/longitude), use the haversine formula instead, since the Earth's curvature makes straight-line distance through the planet wrong.
  • Other distance metrics exist (Manhattan, Chebyshev) but the unqualified 'distance' usually means Euclidean.

Inputs

Enter the (x, y) of point 1 and point 2. For 3D add z. The calculator subtracts coordinates, squares each difference, sums them, and takes the square root.

First point xX-coordinate of the first point.
First point yY-coordinate of the first point.
Second point xX-coordinate of the second point.
Second point yY-coordinate of the second point.

Example

Distance from (1, 2) to (4, 6): d = sqrt((4-1)^2 + (6-2)^2) = sqrt(9 + 16) = sqrt(25) = 5. In 3D from (0, 0, 0) to (3, 4, 12): sqrt(9 + 16 + 144) = sqrt(169) = 13.

FAQ

What is the distance formula?

The distance between two points (x1, y1) and (x2, y2) is sqrt((x2-x1)^2 + (y2-y1)^2). In 3D add (z2-z1)^2 inside the square root.

How do you find the distance between two points?

Subtract the x-coordinates and y-coordinates, square each, add them, take the square root. Between (1,2) and (4,6): sqrt(3^2 + 4^2) = 5.

What is the 3D distance formula?

d = sqrt((x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2). It extends the 2D formula by adding the squared z difference.

Does the order of points matter?

No. Because each difference is squared, swapping the points gives the same distance. Distance from A to B equals distance from B to A.

Why is the distance formula based on the Pythagorean theorem?

Drawing the horizontal and vertical differences forms a right triangle. The straight line between the two points is the hypotenuse, so c^2 = a^2 + b^2 gives the squared distance.

What should I verify before using distance calculator?

Verify first point x, first point y, and second point x, the displayed formula, and the worked example before copying the result into another document or decision.

Sources

Last reviewed: 2026-05-26

Disclaimer

Results are Euclidean (straight-line) distances in a flat coordinate system. For locations on Earth, use a great-circle (haversine) calculator instead.