Distance Between Two Points Calculator

Plot two coordinates and get the exact straight-line distance between them, with the math shown step by step.

What "Distance Between Two Points" Actually Means

On a coordinate plane, every point has an address made of two numbers: how far it sits along the x-axis and how far along the y-axis. The distance between two such points is simply the length of the straight line segment connecting them — the shortest possible path, ignoring any grid lines or detours.

This isn't just an abstract exercise. It's the same idea a delivery app uses when it estimates "as the crow flies" distance, the same idea a game engine uses to check if two characters are close enough to collide, and the same idea a robot's navigation system uses to judge how far it is from its target.

At a glance:
• Formula: d = √[(x₂ − x₁)² + (y₂ − y₁)²]
• Built directly on the Pythagorean theorem
• Works in any direction — the order of the points doesn't matter
• Extends naturally to 3D with a third coordinate (z)
• Result is always a non-negative number

Distance Calculator

Coordinate Plot

Distance

9.22

units

Δx (horizontal)

6

units

Δy (vertical)

8

units

The Distance Formula, Explained

Formula:

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

The horizontal gap and vertical gap become the two legs of a right triangle; the distance is its hypotenuse.

Where It Comes From

Draw a horizontal line from point A and a vertical line down from point B — they meet at a right angle, forming a right triangle. The horizontal leg has length (x₂ − x₁), the vertical leg has length (y₂ − y₁), and the segment connecting the original points is the hypotenuse. Pythagoras' theorem (a² + b² = c²) then hands you the distance directly.

Worked Example

Given: A(1, 2) and B(7, 10)

Step 1: Subtract the x-values → 7 − 1 = 6
Step 2: Subtract the y-values → 10 − 2 = 8
Step 3: Square and add → 6² + 8² = 36 + 64 = 100
Step 4: Take the square root → √100 = 10 units

Common Variations of the Formula

2D distance is what this calculator solves: two coordinates, one flat plane. It's the version used in maps, floor plans, and screen coordinates.

3D distance adds a z-coordinate for depth or elevation: d = √[(x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²]. This is what a flight simulator or a 3D modeling tool uses, since altitude matters as much as position on the ground.

Manhattan distance is a different measurement entirely — instead of a straight diagonal line, it adds up horizontal and vertical movement separately (|x₂−x₁| + |y₂−y₁|), matching how you'd actually walk along city blocks laid out in a grid.

Quick Reference Table

Point A Point B Distance Notes
(0, 0) (3, 4) 5 Classic 3-4-5 triangle
(-2, 1) (2, 1) 4 Same y-value, purely horizontal
(5, -3) (5, 6) 9 Same x-value, purely vertical
(1, 1) (4, 5) 5 Diagonal, 3-4-5 again

Where This Formula Shows Up in Real Life

GPS & Navigation: Mapping apps convert latitude and longitude into planar coordinates over short distances to estimate straight-line separation before calculating an actual driving or walking route around obstacles.

Video Game Development: Collision detection, enemy aggro range, and "is the player close enough to interact" checks all boil down to comparing a distance value against a threshold, calculated many times per second.

Robotics & Path Planning: A robot arm or autonomous vehicle constantly measures its distance to waypoints and obstacles to decide how to move next, recalculating this formula continuously as it operates.

Data Science & Machine Learning: Algorithms like k-nearest neighbors classify data points by measuring the Euclidean distance between them in multi-dimensional feature space — the same formula, just with more coordinates.

Architecture & Site Planning: Measuring clearances between structures, property lines, or utility lines on a scaled site plan uses the same coordinate-distance logic, just applied to blueprint units instead of map units.

Astronomy: Plotting star positions on a 2D sky chart and estimating apparent separation between two celestial objects relies on this same coordinate math, adapted to angular coordinates.

Tips for Getting It Right

✓ Order doesn't matter: Subtracting A from B or B from A gives the same final distance, because both differences get squared — negative signs disappear.

✓ Watch for sign errors: When one or both points have negative coordinates, double-check your subtraction. (−2) − 5 is −7, not 3 — a very common slip.

✓ Recognize Pythagorean triples: If Δx and Δy form a known triple like 3-4-5, 6-8-10, or 5-12-13, you can skip the square root entirely and read the answer straight off.

✓ Same axis, simpler formula: If both points share the same x or the same y, the distance formula collapses to a simple subtraction of the other coordinate — no square roots needed.

✓ This measures straight-line distance only: It won't account for walls, roads, or terrain. For real-world travel distance, you need a routing algorithm, not this formula.

✓ Extending to more dimensions: Add one squared term per extra coordinate under the square root, and the same logic scales cleanly from 2D to 3D and beyond.

The Math Behind the Formula

A Direct Descendant of Pythagoras: The distance formula isn't a separate discovery — it's the Pythagorean theorem wearing coordinate-geometry clothes. The theorem itself is credited to the Greek mathematician Pythagoras (circa 570–495 BCE), though evidence suggests Babylonian mathematicians understood the relationship centuries earlier.

The Coordinate Plane's Origin: The idea of locating points with paired numbers is credited to René Descartes in the 17th century, which is why we still call it the "Cartesian" plane today. Before Descartes, geometry and algebra were largely treated as separate disciplines.

Why "Euclidean": This straight-line measurement is formally called Euclidean distance, named after the ancient Greek mathematician Euclid, whose geometric axioms still underpin the flat, "ordinary" space this formula assumes.

Beyond Flat Space: On a curved surface, like the surface of the Earth, this formula becomes an approximation rather than an exact answer, which is why long-distance navigation instead relies on great-circle distance formulas.

Frequently Asked Questions

Q: What if the two points have the same coordinates?

The distance is zero. Every term inside the square root becomes zero, since there's no horizontal or vertical gap between the points.

Q: Can the distance ever be negative?

No. Squaring the differences removes any negative signs, and the square root of a non-negative number is always non-negative, so distance is always zero or positive.

Q: How is this different from finding the midpoint?

The midpoint formula averages the coordinates to find the point exactly halfway between A and B. The distance formula measures the length between them. They're often used together but answer different questions.

Q: Does this formula work for points on a map with latitude and longitude?

Only as a rough approximation over short distances. Latitude and longitude are angular coordinates on a sphere, so long-distance calculations need a formula like the Haversine formula instead.

Q: What units will my answer be in?

Whatever unit your coordinates are already in. If your coordinates are in meters, your distance is in meters; if they're unitless grid coordinates, so is the result.

Q: How do I find the distance between three or more points?

You calculate it pairwise — one distance value per pair of points. There's no single formula that returns a combined distance for more than two points at once.