Elecmetric

Distance Calculator

Enter the coordinates of two points and get the straight-line distance, the horizontal distance, the differences along each axis

Point 1, x 0, point 1, y 0, point 2, x 3, point 2, y 4 gives
Distance between the points: 5 · Horizontal distance: 5 · Difference in x: 3

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

What remains unverified

Verification register entry

Calculation authorRahul Sharma (author)
Technical reviewNo independent technical review has been carried out
Individual professional approvalNot recorded
Formula referencenot recorded
Standard and editionNot applicable: Pure mathematics or statistics; no electrical standard governs the method
Standard review stateNot applicable
Scope-screening notenot recorded
Cross-check test cases34 reference vectors (tests/reference_vectors.json)
Review datenot recorded
Next review datenot recorded
StatusEngineering 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

distance = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²) horizontal = √(Δx² + Δy²) midpoint = ((x₁ + x₂) / 2, (y₁ + y₂) / 2, (z₁ + z₂) / 2) angle = atan(Δz / horizontal)

Worked example

InputValue
Point 1, x0
Point 1, y0
Point 2, x3
Point 2, y4
  1. Differences: Δx = 3 Δy = 4 Δz = 0
  2. Distance = √(Δx² + Δy² + Δz²) = 5 Horizontal distance = √(Δx² + Δy²) = 5
  3. Midpoint = (1.5, 2, 0)
  4. Angle above the horizontal = atan(Δz / horizontal) = 0°

Assumptions

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

InputUnitAllowed or shownNote
Point 1, x(number)-1,000,000,000,000 or more, up to 1,000,000,000,000Use 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 blankThe 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
ResultUnitAllowed or shownNote
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, xDistance between the pointsHorizontal distanceDifference in x
0.34.0112342244.0112342240.3
0.754.0697051494.0697051490.75
1.54.27200187274.27200187271.5
3553
67.21110255097.21110255096
1212.649110640712.649110640712
3030.265491900830.265491900830

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.

More Engineering Mathematics calculatorsAll engineering calculatorsDistance Calculator (Between Two Points, 2D or 3D) in Elecmetric

Tell us how to improve this page

This opens your email app. Nothing is sent until you press send.