Skip to content
MoneyDeck

Point to Line Distance Calculator

Shortest distance from a point to a line or plane, with the closest point

Updated · Free, no signup

Shortest distance

5.8

Closest point (foot of perpendicular)

(1.52, 1.36)

Signed distance

5.8

Positive on the side the normal (A, B[, C]) points to.

Line / plane used

3x + 4y − 10 = 0
  • |3·5 + 4·6 + (-10)| ÷ √(25) = 5.8

About the Point to Line Distance Calculator

The distance from a point to a line is the length of the perpendicular dropped from the point onto the line — the shortest possible gap between them. This point to line distance calculator handles four common setups: a 2D line written as Ax + By + C = 0, a 2D line through two points, a 3D line through two points, and a plane Ax + By + Cz + D = 0 in 3D.

Along with the distance it gives the foot of the perpendicular (the closest point on the line or plane), and for equation-form lines and planes the signed distance, which tells you which side of the line or plane the point is on.

Typical uses include analytic geometry and calculus homework, checking clearances in CAD drawings, computing cross-track error from a planned route, and measuring how far a data point lies from a regression or boundary line. The line is treated as infinite in both directions, not as a segment.

With the default inputs, the shortest distance is 5.8. Change any value above to recalculate instantly.

How to use the point to line distance calculator

  1. 1Choose how the line or plane is given: equation or two points, 2D or 3D.
  2. 2Enter the coordinates of your point.
  3. 3Enter the equation coefficients or the two points on the line.
  4. 4Read the distance and the closest point on the line or plane.

Formula and method

2D: d = |Ax₀ + By₀ + C| ÷ √(A² + B²) · Plane: d = |Ax₀ + By₀ + Cz₀ + D| ÷ √(A² + B² + C²) · Line through P₁, P₂: d = |(P₀ − P₁) × (P₂ − P₁)| ÷ |P₂ − P₁|

For a line Ax + By + C = 0 the vector (A, B) is perpendicular to the line. Plugging the point into the left-hand side and dividing by the length of that normal vector gives the signed perpendicular distance; its absolute value is the shortest distance. The same idea works for a plane in 3D with normal (A, B, C). The foot of the perpendicular is the point minus the signed distance times the unit normal.

For a line through two points P₁ and P₂, the calculator projects the vector P₀ − P₁ onto the direction d = P₂ − P₁: t = (P₀ − P₁)·d ÷ |d|². The closest point is P₁ + t·d and the distance is the length from P₀ to it — equivalently the cross-product formula above. The line is infinite; if t falls outside 0–1 the closest point is beyond your two points.

(x₀, y₀, z₀)
The point P₀
A, B, C, D
Coefficients of the line or plane equation
P₁, P₂
Two distinct points on the line
t
Position of the closest point along P₁ → P₂
d
Shortest (perpendicular) distance

Worked examples

Point (5, 6) to the line 3x + 4y − 10 = 0

Substituting the point gives 3·5 + 4·6 − 10 = 29, and the normal (3, 4) has length √(3² + 4²) = 5, so the distance is 29 ÷ 5 = 5.8. The foot of the perpendicular is (5, 6) − 5.8 × (0.6, 0.8) = (1.52, 1.36).

Point (5, 6) to the line through (0, 0) and (4, 2)

The direction is (4, 2). Projecting (5, 6) gives t = (20 + 12) ÷ 20 = 1.6, so the closest point is (6.4, 3.2), beyond the second point. The gap is √(1.4² + 2.8²) ≈ 3.1305.

Point (1, 2, 3) to the plane 2x − y + 2z − 4 = 0

2·1 − 2 + 2·3 − 4 = 2 and the normal (2, −1, 2) has length 3, so the point is 2/3 ≈ 0.6667 units from the plane, on the side the normal points to.

Point (1, 1, 1) to the 3D line through (0, 0, 0) and (1, 2, 2)

With d = (1, 2, 2), t = (1 + 2 + 2) ÷ 9 = 5/9, so the foot is (5/9, 10/9, 10/9). The distance from (1, 1, 1) to that point is √(16 + 1 + 1)/9 = √18/9 ≈ 0.4714.

Frequently asked questions

What is the formula for the distance from a point to a line?+

For a line Ax + By + C = 0 and point (x₀, y₀), d = |Ax₀ + By₀ + C| ÷ √(A² + B²). For example, the point (5, 6) is 29 ÷ 5 = 5.8 units from 3x + 4y − 10 = 0.

How do I convert y = mx + b to the Ax + By + C = 0 form?+

Move everything to one side: mx − y + b = 0, so A = m, B = −1 and C = b. The line y = 2x + 3 becomes 2x − y + 3 = 0.

How do you find the distance from a point to a line in 3D?+

Pick two points P₁ and P₂ on the line and compute |(P₀ − P₁) × (P₂ − P₁)| ÷ |P₂ − P₁|. The cross product’s length is the area of a parallelogram, and dividing by the base gives its height — the distance.

What does a negative signed distance mean?+

It means the point lies on the opposite side of the line or plane from the direction the normal vector (A, B) or (A, B, C) points. The absolute value is the actual distance.

Is the distance to a line the same as to a line segment?+

Not always. This calculator treats the line as infinite. If the closest point falls outside the segment between your two points (t below 0 or above 1), the distance to the segment is the distance to the nearer endpoint instead.

Related tools