Mathematics calculator

Distance Calculator

Calculate the straight-line Euclidean distance between two points on a coordinate plane.

Calculator inputs

Enter your values

Two-point distance
Calculated output

Result summary

Your result will appear here

Complete the required fields and select the calculate button.

Two coordinate points joined by a segment with horizontal and vertical changes forming a right triangle
The coordinate differences form perpendicular legs, so the Pythagorean theorem gives the segment length.

What Is Straight-Line Distance Between Two Points?

The distance calculator finds the length of the straight segment joining two points on a flat coordinate plane. Give each point as an ordered pair, such as (1, 2) and (4, 6), and the result is expressed in the same unit used on both axes. This is the familiar Pythagorean distance, sometimes called Euclidean distance.

It is useful for coordinate geometry, maps drawn on a rectangular grid, engineering sketches and quick checks of displacement. It does not follow roads, curved surfaces or obstacles. A map distance is meaningful only when the x- and y-coordinates use the same scale.

How to Calculate Distance from Coordinates

  1. Enter the first point in the First point x₁ and First point y₁ boxes. Keep the coordinates in their stated order.
  2. Enter the second point in Second point x₂ and Second point y₂. Decimal and negative coordinates are allowed.
  3. Confirm that both axes use the same unit and scale. Convert one axis first if, for example, x is in metres and y is in centimetres.
  4. Select Calculate. The page subtracts corresponding coordinates, squares the two changes, adds them, and takes the square root.
  5. Use Reset before starting a separate problem so that an old coordinate is not left in the form.

The order of the points does not affect the distance. Swapping point 1 with point 2 changes the signs of both coordinate differences, but squaring removes those signs. Keeping a small sketch beside the numbers is still helpful because it catches transposed x and y values.

Two-Point Distance Formula

Horizontal change Δx = x₂ − x₁

Vertical change Δy = y₂ − y₁

Squared distance d² = (Δx)² + (Δy)²

Distance d = √((Δx)² + (Δy)²)

The coordinate changes are perpendicular legs of a right triangle. Applying the Pythagorean theorem gives the segment length, as explained in the OpenStax coordinate geometry chapter. A negative change describes direction; squaring it contributes a positive amount to d².

The distance rounds to six decimals. Coordinate changes and squared distance round to eight. Squared distance uses the unrounded segment length, so squaring the shortened distance display can differ slightly from that reference result.

Coordinates, Changes and Distance Results

First point x₁ and y₁
Horizontal and vertical coordinates of the first endpoint. Negative, zero and decimal values are allowed.
Second point x₂ and y₂
Coordinates of the other endpoint on the same flat coordinate system and scale.
Straight-line distance d
Nonnegative planar length, rounded to six decimals. Its unit is the common coordinate length unit.
Horizontal change Δx
Signed x₂ − x₁, rounded to eight decimals.
Vertical change Δy
Signed y₂ − y₁, rounded to eight decimals.
Squared distance
d² in squared coordinate units, rounded to eight decimals. It is not another length.

Coordinate Distance Calculation Example

Illustrative example. Let A = (−4, 2) and B = (8, −3). Enter each ordered pair with x first and y second.

The horizontal change is 8 − (−4) = 12. The vertical change is −3 − 2 = −5. Then d² = 12² + (−5)² = 144 + 25 = 169.

Taking the square root gives 13 coordinate units. Reversing A and B changes the differences to −12 and 5, but their squares still give the same distance.

Calculation check. These illustrative results were checked independently against the formula and calculator response. Keep unrounded intermediate values when repeating the calculation.

Coordinate Distance Calculation Example
Calculation stepValue
Horizontal change Δx12
Vertical change Δy−5
Squared distance d²169
Straight-line distance13

Straight-Line Distance, Path Length and Midpoint

A segment length, a route length and a midpoint answer different questions. The calculation on this page uses a flat plane with matching axis units. It does not model a street network, obstacles or Earth’s curved surface.

Straight-Line Distance, Path Length and Midpoint
QuantityWhat it tells you
Straight-line distanceShortest planar separation between the endpoints
Path lengthDistance along the actual route, possibly longer
MidpointThe coordinates halfway along the segment
Signed coordinate changeDirection and amount of change on one axis

How to Interpret Planar Distance

The answer is the shortest planar separation between the two locations. If the axes are measured in metres, the distance is metres; if they are unitless graph coordinates, report coordinate units. An exact distance of zero means the ordered pairs describe the same point. A tiny positive separation can also display as zero after six-decimal rounding.

This answer is often a displacement magnitude rather than travel distance. Walking around a building, following a street network or moving along a curve normally takes farther than the straight segment. Latitude and longitude also need a geographic method because degrees of longitude cover different ground distances at different latitudes and Earth is not a flat rectangular plane.

The displayed answer is rounded to six decimal places. For measured data, report only the precision the measurements justify. Keeping extra digits during the calculation is useful, but six displayed decimals do not make rough coordinates more accurate.

Common Coordinate Distance Mistakes

  • Do not add coordinate changes directly. Changes of 3 and 4 give a distance of 5, not 7.
  • Keep each point in (x, y) order. Reversing only one point changes the geometry.
  • Square the entire difference, including a negative sign. For example, (−3)² is 9.
  • Use one unit and scale on both axes before calculating.
  • Do not treat this flat-plane result as a road route or long-distance Earth measurement.

Frequently Asked Questions

Can I use negative or decimal coordinates?

Yes. Coordinates may be negative or decimal values. Subtract them with their signs intact; the squared differences make the final distance nonnegative.

Does it matter which point I enter first?

No. Reversing the two points changes each difference to its opposite, but the squares and final distance stay the same.

Why is the result not the same as a route planner?

This formula measures one straight segment on a flat plane. A route planner follows available roads or paths and may also account for Earth’s surface.

What unit does the answer use?

It uses the common unit of the coordinates. If both axes are in kilometres, the answer is kilometres. Unitless graph coordinates produce coordinate units.

Can I use latitude and longitude?

Not directly for an accurate geographic distance. Latitude and longitude are angular coordinates on Earth, so use a geodesic or great-circle calculation instead.

Why can the calculator show zero for two entries?

Identical points have zero distance. A positive separation smaller than half of one millionth of a coordinate unit can also round to zero at six decimals. Check the original coordinates before concluding that the points coincide.

What happens if only one coordinate changes?

For a horizontal segment, distance is |x₂ − x₁|. For a vertical segment it is |y₂ − y₁|. The full formula gives these results because the other difference is zero.

Why does squared distance use a different unit?

Squaring a length squares its unit. A distance in meters has squared distance in m²; take the square root to return to meters.

Sources and References