Distance Calculator
Enter the coordinates of two points and get the straight-line distance, the horizontal distance, the differences along each axis
Try your own numbers
Estimate only. Not engineering or safety advice. Check the result against the applicable standard and the equipment data, and have a competent engineer review it before it is relied on. Terms of use.
Open in the calculator with these values
About this calculator
This page calculates distance between the points, horizontal distance, difference in x and 6 more results from point 1, x, point 1, y, point 1, z, point 2, x and 2 more inputs. Change any value or its unit and the result updates. The steps below show the working for the default values, so you can check each line against your own method.
Limits of this calculator
Use this to find the straight-line distance between two positions on a site plan, the length of a diagonal cable or conduit run in 3D, the span between two poles or towers, or the midpoint of a run for placing a pull box. For the length along a right-angled path use the Pythagorean theorem calculator, and for the slope of the line use the slope calculator.
Cross-check: 34 reference cases, calculated from textbook formulas coded separately from the engine by the same author, agree with this calculator. This is not an independent review.
Verification status: Engineering reference
Engineering reference. Formula and method documented and tested against separately coded reference calculations. Not yet Verified: the evidence listed on this page is still needed.
What this calculator checks
- The arithmetic of the published formula for the values you entered, in the units shown.
What remains unverified
- That the inputs suit your application. Take ratings, resistances and constants from the manufacturer data sheet or project specification.
Verification register entry
| Calculation author | Rahul Sharma (author) |
|---|---|
| Technical review | No independent technical review has been carried out |
| Individual professional approval | Not recorded |
| Formula reference | not recorded |
| Standard and edition | Not applicable: Pure mathematics or statistics; no electrical standard governs the method |
| Standard review state | Not applicable |
| Scope-screening note | not recorded |
| Cross-check test cases | 34 reference vectors (tests/reference_vectors.json) |
| Review date | not recorded |
| Next review date | not recorded |
| Status | Engineering reference |
Needed before this calculator can be marked Verified: reviewer name, qualification and review date; exact formula reference; formula source (textbook or standard); next review date.
Formula
Worked example
| Input | Value |
|---|---|
| Point 1, x | 0 |
| Point 1, y | 0 |
| Point 2, x | 3 |
| Point 2, y | 4 |
- Differences: Δx = 3 Δy = 4 Δz = 0
- Distance = √(Δx² + Δy² + Δz²) = 5 Horizontal distance = √(Δx² + Δy²) = 5
- Midpoint = (1.5, 2, 0)
- Angle above the horizontal = atan(Δz / horizontal) = 0°
Assumptions
- The distance is the straight line between the two points, not the length of a cable route that goes around obstacles, so a real cable needs an allowance on top
- Every coordinate is in one consistent unit and the distance is in that same unit. Negative coordinates are allowed
- A blank z is taken as 0, so leaving every z blank gives the 2D distance. If only one point has a z value a note says the blank one was taken as 0
- The angle is measured up from the horizontal plane; it is negative when point 2 is lower than point 1, and is not defined when the two points are the same
- The tool works on plain numbers and does not track units
Use this to find the straight-line distance between two positions on a site plan, the length of a diagonal cable or conduit run in 3D, the span between two poles or towers, or the midpoint of a run for placing a pull box. For the length along a right-angled path use the Pythagorean theorem calculator, and for the slope of the line use the slope calculator.
Inputs and results
| Input | Unit | Allowed or shown | Note |
|---|---|---|---|
| Point 1, x | (number) | -1,000,000,000,000 or more, up to 1,000,000,000,000 | Use the same unit for every coordinate; negative values are allowed. |
| Point 1, y | (number) | -1,000,000,000,000 or more, up to 1,000,000,000,000 | |
| Point 1, z (optional) | (number) | -1,000,000,000,000 or more, up to 1,000,000,000,000; may be left blank | The height or third coordinate. Leave it blank for a flat 2D drawing; a blank z is taken as 0. |
| Point 2, x | (number) | -1,000,000,000,000 or more, up to 1,000,000,000,000 | |
| Point 2, y | (number) | -1,000,000,000,000 or more, up to 1,000,000,000,000 | |
| Point 2, z (optional) | (number) | -1,000,000,000,000 or more, up to 1,000,000,000,000; may be left blank |
| Result | Unit | Allowed or shown | Note |
|---|---|---|---|
| Distance between the points | (number) | Shown to 10 decimal places | |
| Horizontal distance (x and y only) | (number) | Shown to 10 decimal places | |
| Difference in x | (number) | Shown to 10 decimal places | |
| Difference in y | (number) | Shown to 10 decimal places | |
| Difference in z | (number) | Shown to 10 decimal places | |
| Midpoint x | (number) | Shown to 10 decimal places | |
| Midpoint y | (number) | Shown to 10 decimal places | |
| Midpoint z | (number) | Shown to 10 decimal places | |
| Angle of the line above the horizontal (degrees) | (number) | Shown to 8 decimal places |
How it is calculated
Each input is converted to the base unit of its quantity, the formula above is applied in the order shown in the worked example, and each result is shown in the unit you choose. Results are held at full precision and rounded only for display, except where a step selects a standard size, as the worked example shows. A value outside its allowed range is refused with a message instead of giving a result.
How the result changes with point 2, x
| Point 2, x | Distance between the points | Horizontal distance | Difference in x |
|---|---|---|---|
| 0.3 | 4.011234224 | 4.011234224 | 0.3 |
| 0.75 | 4.069705149 | 4.069705149 | 0.75 |
| 1.5 | 4.2720018727 | 4.2720018727 | 1.5 |
| 3 | 5 | 5 | 3 |
| 6 | 7.2111025509 | 7.2111025509 | 6 |
| 12 | 12.6491106407 | 12.6491106407 | 12 |
| 30 | 30.2654919008 | 30.2654919008 | 30 |
Other inputs are the same as in the worked example above.
Standards and further reading
Complex numbers, rectangular and polar form and angle conversion are standard mathematics, not the subject of a standard. Standards apply when the result feeds an electrical design, and they set the method there.
Frequently asked questions
What do I need to enter?
Enter point 1, x, point 1, y, point 1, z (optional), point 2, x, point 2, y, point 2 and z (optional). Change the unit of a value with its selector and the result stays the same.
What does this calculator assume?
The distance is the straight line between the two points, not the length of a cable route that goes around obstacles, so a real cable needs an allowance on top. Every coordinate is in one consistent unit and the distance is in that same unit. Negative coordinates are allowed. A blank z is taken as 0, so leaving every z blank gives the 2D distance. If only one point has a z value a note says the blank one was taken as 0. The angle is measured up from the horizontal plane; it is negative when point 2 is lower than point 1, and is not defined when the two points are the same. The tool works on plain numbers and does not track units.
Which calculators should I use next?
Common next steps are Slope Calculator (Gradient, Grade and Angle from Two Points), Pythagorean Theorem (Right Triangle) Calculator, Vector Calculator (3D) and Triangle Calculator (Three Sides). The related links at the bottom of this page open them.
How accurate are the results?
Every figure comes from the same tested engine as the Elecmetric calculators and is meant for estimating. 34 reference cases, calculated from textbook formulas coded separately from the engine by the same author, agree with this calculator. This is not an independent review. Check design values against the standard and the equipment data you work to.
Formula guides and reference
Longer explanations with worked examples and tables, written for the same topic.
- Trigonometry Formulas for Electrical Engineers: Sine, cosine and tangent formulas for engineers: the six trig functions, degrees and radians
- Cable Pulling Tension Formulas: Cable pulling tension formulas: tension on a straight run from weight, length and friction, the increase around a bend
- Complex Number Formulas: Polar and Rectangular: Complex number formulas for engineers: rectangular and polar form, conversion with atan2, addition
More Engineering Mathematics calculatorsAll engineering calculatorsDistance Calculator (Between Two Points, 2D or 3D) in Elecmetric