Enter two points to get the straight-line distance in 2D or 3D, with the distance formula, midpoint and full working shown — free, no sign-up.
Distance Calculator
Type in two points and get their straight-line distance instantly — 2D or 3D, with the midpoint thrown in.
Enter your values
Fill in the fields below — the result appears with every step shown.
Your result will appear here
Enter your values above, then press Calculate — or press Enter in any field.TinyExe · Distance Result
Calculated locally in your browser
—
Name
—
Point 1 — x
—
Point 1 — y
—
Point 2 — x
—
How this was calculated
What to do next
TinyExe PDF & PNG exports carry the TinyExe logo and tinyexe.com header & footer.
Runs 100% in your browser — your numbers never leave this tab; nothing is uploaded or stored.
The short answer
The distance between two points (x1, y1) and (x2, y2) is sqrt((x2 - x1) squared plus (y2 - y1) squared). For example, between (0, 0) and (3, 4): the differences are 3 and 4, so distance equals sqrt(9 + 16) equals sqrt(25) equals 5 units.
- Distance = sqrt((x2-x1)^2 + (y2-y1)^2) in 2D
- 3D adds (z2-z1)^2 under the root
- Distance is never negative; identical points give 0
Classic Pythagorean triples (dx, dy, distance)
Reference values for this calculator.
| dx | dy | Distance |
|---|---|---|
| 3 | 4 | 5 |
| 5 | 12 | 13 |
| 6 | 8 | 10 |
| 8 | 15 | 17 |
| 1 | 1 | 1.4142 |
The formula
The exact formula this calculator uses — every variable in it is explained in the card below.
The formula
The distance formula is Pythagoras applied to coordinate differences: the straight line between two points is the hypotenuse of a right triangle whose legs are the x and y differences. Ideas enhancement over the old limited family kernel: a 2D/3D mode switch plus the midpoint of the two points shown as a detail, so one run answers both "how far apart?" and "what is halfway between them?".
Worked examples
Worked examples with the full working shown — try them in the calculator to check.
Example 1
The 3-4-5 triangle
Point A (0, 0), point B (3, 4), 2D mode
| Calculation | Steps |
|---|---|
| dx = 3 - 0 = 3 and dy = 4 - 0 = 4. Squares: 9 and 16. Sum = 25. sqrt(25) = 5. | Distance = 5 units; midpoint (1.5, 2). |
Result
Example 2
Points in the negative quadrant
Point A (-2, -1), point B (1, 3), 2D mode
| Calculation | Steps |
|---|---|
| dx = 1 - (-2) = 3 and dy = 3 - (-1) = 4. Squares 9 + 16 = 25, sqrt(25) = 5. | Distance = 5 units — signs disappear once squared. |
Result
Example 3
A 3D space diagonal
Point A (0, 0, 0), point B (1, 2, 2), 3D mode
| Calculation | Steps |
|---|---|
| dx = 1, dy = 2, dz = 2. Squares: 1 + 4 + 4 = 9. sqrt(9) = 3. | Distance = 3 units. |
Result
How to use this calculator
Step 1
Enter the x and y coordinates of the first point.
Step 2
Enter the x and y coordinates of the second point.
Step 3
Choose 2D for flat coordinates, or 3D and also enter both z coordinates.
Step 4
Press Calculate to get the straight-line distance, the coordinate differences and the midpoint.
Frequently asked questions
What is the distance formula?
For two points (x1, y1) and (x2, y2), distance = sqrt((x2 - x1)^2 + (y2 - y1)^2). It is the Pythagorean theorem applied to the horizontal and vertical differences between the points.
Does the order of the points matter?
No. Squaring removes the sign of each difference, so point A to point B gives exactly the same distance as point B to point A.
How do I find distance in 3D?
Add the squared z difference under the same square root: sqrt((x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2). Choose the 3D mode in this calculator and enter both z coordinates.
Can distance be negative?
No. Distance is a length, so it is always zero or positive. It is zero only when the two points are identical.
Is this the same as travel distance?
No. This is straight-line (as-the-crow-flies) distance. Road or walking distance follows a route and is almost always longer.
About this calculator
The Distance Calculator finds the straight-line length between two points on a coordinate plane (2D) or in space (3D). It uses the distance formula, which is the Pythagorean theorem rewritten in coordinates: square the horizontal difference, square the vertical difference, add, and take the square root.
Geometrically, the two points and their differences form a right triangle. The horizontal leg has length |x2 - x1|, the vertical leg has length |y2 - y1|, and the line joining the points is the hypotenuse. Pythagoras then gives distance squared = dx squared + dy squared, which is exactly the distance formula — it is not a separate rule to memorise, just the theorem in coordinate form.
In 3D the same idea extends once more: the separation in space is the diagonal of a box whose sides are dx, dy and dz, so distance = sqrt(dx^2 + dy^2 + dz^2). This is the formula games, robotics and physics code use constantly, because Euclidean distance is the natural "how far" measure in flat space.
The most common mistakes are subtracting coordinates in different orders for x and y (harmless, since squares remove signs), forgetting the final square root (which leaves you with distance squared), and mixing units — if x is in metres and y in kilometres the answer is meaningless until both use the same unit.
Use it for geometry homework, checking how far apart two map grid references are, game and graphics programming (sprite or waypoint separation), CAD and machining layouts, and any time you need the direct separation rather than a routed path.
How to calculate it yourself
Step 1
Subtract the x coordinates to get dx = x2 - x1.
Step 2
Subtract the y coordinates to get dy = y2 - y1 (and the z coordinates too in 3D).
Step 3
Square each difference.
Step 4
Add the squares together.
Step 5
Take the square root of the sum — that is the distance.
Real-life examples
Warehouse robot routing check
A warehouse robot sits at grid position (2, 3) metres and must collect a pallet at (8, 11) metres. The engineer wants the straight-line travel distance to sanity-check the route plan.
dx = 8 - 2 = 6, dy = 11 - 3 = 8. Distance = sqrt(36 + 64) = sqrt(100) = 10 metres.
The direct distance is 10 m; any real aisle route will be longer, so a planned 13 m route is plausible.
Fence across a garden plot
A gardener marks two opposite corners of a rectangular plot at (0, 0) and (12, 5) metres and wants the diagonal length for a cross-brace.
dx = 12, dy = 5. Distance = sqrt(144 + 25) = sqrt(169) = 13 metres.
A 13 m brace spans the diagonal exactly.
Ideas & use cases
- Compare straight-line distance with a quoted route distance: a big gap tells you the route detours a lot, which matters for delivery and drone range estimates.
- Find safe spacing: run pairs of proposed equipment positions through the calculator to confirm they meet a minimum separation rule.
- Reverse-check a scale drawing: measure two points on the drawing, compute the distance, and compare it with the stated real-world dimension to verify the scale.
Limitations & sources
- Straight-line Euclidean distance only, in whatever units the coordinates use. It does not compute road distance, great-circle (map) distance, or distance along a curve.
Sources: Standard Euclidean distance formula: any analytic geometry textbook (e.g. Stewart, Calculus, distance in three-space); calculator.net distance calculator behaviour cross-checked
