Distance between two points calculator

Enter the coordinates of two points: x₁, y₁, x₂, y₂. The result is the Euclidean distance d = √((x₂−x₁)²+(y₂−y₁)²), then round(d×1e6)/1e6. With (0, 0) and (3, 4) the distance is 5. With (0, 0) and (1, 1) it is about 1.414214. The form is for the 2D plane — it does not compute 3D or GPS distance.

Inputs

Result

Enter x₁, y₁, x₂, y₂.

An empty field counts as 0. The primary result uses the 1e6 round — (0,0) and (1,1) give 1.414214, not raw √2.

How it works

How d is computed for (0,0) and (3,4)
Δx3
Δy4
Δx²+Δy²25
d5

The distance between two points in the plane is the length of the segment joining A = (x₁, y₁) to B = (x₂, y₂). In the Euclidean metric — the same geometry Euclid described and René Descartes (1596–1650) wrote in coordinates — the formula is d = √((x₂ − x₁)² + (y₂ − y₁)²). The differences Δx and Δy are the legs; d is the hypotenuse. That is the Pythagorean theorem in the Cartesian plane, not an invented index.

The calculator uses the numbers you enter: four coordinates in fields x₁, y₁, x₂, y₂ (IDs a–d stay unchanged). It computes raw d = √(Δx²+Δy²), then applies round(d×1e6)/1e6. For (0, 0) and (3, 4) you get a clean 5. For (0, 0) and (1, 1) — 1.414214. For (0, 0) and (6, 8) — 10. An empty field counts as 0; when all fields are empty, the panel stays in the waiting state.

Derivation. The vector from A to B is (Δx, Δy). Its Euclidean length ‖B−A‖₂ is the square root of the sum of squared components. That is the same norm used for a vector from the origin — only here the start need not be (0, 0). The panel shows Δx, Δy, Δx²+Δy², and a hypot check.

Rounding. The primary result is not the raw floating-point root. Rounding to six decimal places via ×1e6 removes presentation noise: 5 stays 5, and √2 appears as 1.414214. The diagram draws points A, B and segment AB — the same geometry the formula computes, without a separate visual length scale.

What this calculator does not compute. There is no distance from a line Ax+By+C=0, no midpoint M, and no vector length without a second point. Neighboring calculators: point-to-line distance, segment midpoint, vector length.

Historical and formula sources: Euclid (Elements — segment length), Pythagoras (right-triangle theorem), Descartes (coordinate system), Wikipedia / MathWorld — Euclidean distance, Britannica — Euclidean geometry.

Formula

d = √((x₂ − x₁)² + (y₂ − y₁)²), then round(d × 1e6) / 1e6.

Δx = x₂ − x₁, Δy = y₂ − y₁, sum of squares = Δx² + Δy². The raw root is √ or hypot(Δx, Δy); the primary result uses the 1e6 round.

Mathematical model: Euclidean distance between two points in ℝ² (Pythagorean theorem in the Cartesian plane). The calculator takes the square root of the sum of squared coordinate differences in the browser.

Theory, derivation, and domain

Definition and domain

Let A = (x₁, y₁) and B = (x₂, y₂) be points in the Euclidean plane. The distance between two points is the length of the segment joining A to B. In Cartesian coordinates the formula is d = √((x₂ − x₁)² + (y₂ − y₁)²). The differences Δx = x₂−x₁ and Δy = y₂−y₁ are the legs; d is the hypotenuse. The result is a non-negative scalar, not a point.

Domain of this calculator: all finite real coordinates in the fields x₁, y₁, x₂, y₂ (identifiers a–d). Codomain: d ≥ 0 after round(d×1e6)/1e6. When A = B, you get d = 0 — a valid result. An empty field enters as 0; when all four fields are empty, the panel stays in the waiting state. The result unit is the same unit in which you enter the coordinates.

Euclid: length of a segment

In Euclid’s Elements, segment length is a geometric quantity independent of a coordinate frame. Two points determine exactly one segment; its length is non-negative and zero only when the points coincide. Distance satisfies the metric axioms: d(A,B) = d(B,A), d(A,B) = 0 ⇔ A = B, and the triangle inequality d(A,C) ≤ d(A,B) + d(B,C).

This page computes only the Euclidean metric in the plane. It does not introduce Manhattan distance (|Δx|+|Δy|) or Chebyshev distance. Britannica (“Euclidean geometry”) and MathWorld (“Distance”) describe distance as segment length — the same quantity this calculator writes algebraically. In school and engineering use on a map or in CAD, that length is the straight-line path between two points, without detours around obstacles.

Pythagoras: legs Δx and Δy

If you build a rectangle with sides |Δx| and |Δy| from vertex A, the diagonal to B has length √(Δx²+Δy²). That is the Pythagorean theorem: the sum of the squares of the legs equals the square of the hypotenuse. Squared differences drop the sign, so the direction from A to B does not change d: (0,0) and (−3,−4) give the same 5 as (0,0) and (3,4).

The classic 3-4-5 triple: √(9+16) = 5. Doubling gives 6-8-10 and d = 10. Pythagorean relations were known earlier (including the Plimpton 322 context); Euclid gives an axiomatic proof via areas of squares on the sides (I.47). This calculator does not require integer coordinates — fractional values work as well.

Descartes: the coordinate formula

René Descartes (1596–1650) wrote geometry in coordinates: each point is a pair of numbers. Hence the bridge between Euclidean geometry and algebra: d = √((x₂−x₁)²+(y₂−y₁)²). In vector form, d = ‖B − A‖ — the Euclidean norm of the difference of position vectors. With A = (0,0) the formula reduces to the vector length ‖B‖ = √(x₂²+y₂²).

The calculator may use hypot(Δx, Δy), which computes the same square root with better overflow resistance than √(Δx²+Δy²) for very large coordinates. For typical school examples the result is identical. The panel also shows Δx, Δy, and the sum of squares under the root so the Pythagorean step is visible next to d. The calculator works in R²; it does not add a z coordinate.

Full derivation and examples

Step 1. Compute Δx = x₂−x₁ and Δy = y₂−y₁.

Step 2. Form the sum of squares s = Δx² + Δy² (always ≥ 0).

Step 3. Take the non-negative root d = √s, then round(d×1e6)/1e6.

Step 4. Worked examples on this page: (0,0)&(3,4) → 5; (0,0)&(1,1) → 1.414214 (√2 after rounding); (0,0)&(6,8) → 10; (2,1)&(5,5) → 5 (again Δx=3, Δy=4); (−2,3)&(4,−1) → 7.211103 (√52 after rounding). The result display uses a decimal point in US English formatting.

Numerical notes, neighboring models, and limits

The 1e6 round is a presentation contract: a clean 5 stays 5, not 5.000000; √2 appears as 1.414214. Comma and period are equivalent on input. The SVG diagram draws segment AB; the numeric length comes from the formula, not from pixels.

The midpoint returns the point M = ((x₁+x₂)/2, (y₁+y₂)/2), not the scalar d. Distance from a point to a line uses |Ax₀+By₀+C|/√(A²+B²). Vector length from the origin is the same square root with A = (0,0). A two-leg Pythagorean page enters lengths a and b, not four coordinates. This calculator computes only the Euclidean distance between two points. The result is educational.

Sources

Mathematical model: Euclidean distance between two points. Context: Euclid, Elements (segment length); Pythagorean theorem (I.47 / Heath); René Descartes — coordinate form. Sources MathWorld — Distance; Wikipedia — Euclidean distance; Wikipedia — Pythagorean theorem; Britannica — Euclidean geometry; Brannan, Esplen, Gray — Geometry (Cambridge). The calculator does not replace a textbook or a teacher’s check.

How to use

  1. Enter x₁ and y₁ of the first point, for example 0 and 0.
  2. Enter x₂ and y₂ of the second point, for example 3 and 4.
  3. Click Calculate or wait for the live result. (0,0) and (3,4) give 5.
  4. Check the panel: d, Δx, Δy, Δx²+Δy², hypot, and the AB segment diagram.
  5. An empty field counts as 0. Point-to-line distance and the midpoint live on neighboring pages.

Symbol glossary

d is the Euclidean distance. For (0,0) and (3,4), d = 5. The panel also shows Δx, Δy, and the sum of squares.

(x₁, y₁)
Point A — fields a, b.
(x₂, y₂)
Point B — fields c, d.
Δx, Δy
x₂−x₁ and y₂−y₁ — the legs.
d
√(Δx²+Δy²) after the 1e6 round; always ≥ 0.
Δx²+Δy²
Sum of squares under the root.

Examples

Example 1

  • (0, 0)
  • (3, 4)

5

What distance from (0, 0) to (3, 4)? 5.

Example 2

  • (0, 0)
  • (1, 1)

1.414214

What distance from (0, 0) to (1, 1)? ≈ 1.414214.

Example 3

  • (0, 0)
  • (6, 8)

10

What distance from (0, 0) to (6, 8)? 10.

Example 4

  • (0, 0)
  • (−3, −4)

5

What distance from (0, 0) to (−3, −4)? 5.

Example 5

  • (2, 1)
  • (5, 5)

5

What distance from (2, 1) to (5, 5)? 5.

Example 6

  • (−2, 3)
  • (4, −1)

7.211103

What distance from (−2, 3) to (4, −1)? ≈ 7.211103.

Related calculators

Common questions

What is the distance between two points in the plane?

It is the length of the segment joining A=(x₁,y₁) and B=(x₂,y₂). In the Euclidean metric it equals d = √((x₂−x₁)²+(y₂−y₁)²). The calculator then applies round(d×1e6)/1e6.

What is the formula and where does it come from?

Δx = x₂−x₁ and Δy = y₂−y₁ are the legs of a right triangle. The Pythagorean theorem gives d = √(Δx²+Δy²). In Cartesian coordinates that is the Euclidean distance.

What is the distance from (0,0) to (3,4)?

The result is 5, because √(9+16) = 5. That is the first example on this page and the same result after “Fill this example”.

What is the distance from (0,0) to (1,1)?

After the 1e6 round the result is 1.414214. Raw √2 is longer; the calculator shows round(√2×1e6)/1e6.

What is the distance from (0,0) to (6,8)?

The result is 10. That is a doubled 3-4-5 triangle: √(36+64) = √100 = 10.

What if a coordinate field is empty?

An empty field counts as 0. Empty x₁ and y₁ mean the origin. When all four fields are empty, the panel shows a placeholder instead of a fake result.

Do negative coordinates change the formula?

No. Squared differences drop the sign. (0,0) and (−3,−4) give the same d = 5 as (0,0) and (3,4).

How does this differ from Pythagoras with two legs?

Here you enter four endpoint coordinates. There you enter two leg lengths. With legs 3 and 4 the result is the same 5, but the fields are different.

How does this differ from point-to-line distance?

There is no Ax+By+C=0 equation here. The calculator measures the segment between two points. Point-to-line distance lives on a separate page and uses |Ax₀+By₀+C|/√(A²+B²).

Does the result always show six decimal places?

No. The script applies round(d×1e6)/1e6. A clean 5 stays 5, not 5.000000. For √2 you see 1.414214.

Does a comma in 1,5 work?

Yes. 1,5 and 1.5 mean the same coordinate. Space as a thousands separator is also accepted.

Do the currency and unit settings in the page header affect the result?

No. The result depends only on the four coordinates. The currency and unit settings in the page header do not affect this result.

How do I calculate the distance between two points?

Use d = √((x₂−x₁)²+(y₂−y₁)²): subtract coordinates, square the differences, add them, and take the square root. With (0, 0) and (3, 4): √(9+16) = 5.

What distance from (1, 2) to (4, 6)?

5. Computation: Δx = 3, Δy = 4, √(9+16) = 5. That is the same 3-4-5 triangle as Example 1, only shifted.

Does swapping points A and B change the distance?

No. After swapping A and B the differences Δx and Δy change sign, but the squares stay the same, so d is identical.

Does the calculator compute GPS or 3D distance?

No. Here only the Cartesian x, y plane. Geographic coordinates (haversine) and space with z need other models — they are not on this card.

How does two-point distance differ from vector length?

Here you enter two arbitrary endpoints of a segment. Vector length on the neighboring page computes √(x²+y²) from the origin — one point as components, not a pair of endpoints.

The result is d = √((x₂−x₁)²+(y₂−y₁)²) after the 1e6 round: for (0,0) and (3,4) it equals 5. Δx, Δy, and segment AB are in the panel. Separate point-to-line distance lives on the distance from point to line page.

Knowledge sources

The formula, domain, and historical context below come from recognized geometry sources.

Page Updated November 2, 2026.