Skip to content
The Calculatorz
Coordinate geometry

Distance from a Point to a Line Calculator

Find the shortest distance from a point to a line ax + by + c = 0, with the working, the closest point on the line and which side the point is on.

Results are rounded for display. Check important answers, especially in assessed or technical work.

Line and point

Values

What is the distance from a point to a line?

The distance from a point to a line is the length of the shortest segment joining them, which always meets the line at a right angle. For a line written ax + by + c = 0, it can be found directly by substituting the point into the equation and dividing by √(a² + b²).

How to use this calculator

Write the line in general form ax + by + c = 0 and enter a, b and c, then enter the point. To convert y = mx + k, use a = m, b = −1, c = k. The calculator gives the perpendicular distance and the foot of the perpendicular.

Formula

Distance d = |a·x₀ + b·y₀ + c| ÷ √(a² + b²). Closest point: x = x₀ − a(a·x₀ + b·y₀ + c) ÷ (a² + b²), y = y₀ − b(a·x₀ + b·y₀ + c) ÷ (a² + b²).

Terms in the formula

a, b, c
Coefficients of the line ax + by + c = 0.
(x₀, y₀)
The point.
d
Perpendicular distance.

Understanding your result

The distance is always positive or zero; zero means the point is on the line. The closest point shows exactly where the perpendicular meets the line, useful in geometry problems, computer graphics and fitting lines to data. The units are those of your coordinates.

Calculator credits

Calculator developmentJulia Edwards

Editorial supervision

Expert reviewIfrahMSc Mathematics

Published byThe Calculatorz

Last updated

Read how we research, test, review and correct our calculators in our editorial policy.

Frequently asked questions

What is the shortest distance from a point to a line?

The length of the perpendicular from the point to the line. Any other path to the line is longer.

How do I convert y = mx + c to general form?

Move everything to one side: mx − y + c = 0, so a = m, b = −1 and c is the intercept.

What does a distance of zero mean?

The point lies on the line.

What is the foot of the perpendicular?

The point on the line closest to your point, where a perpendicular from the point meets the line.

Why does the sign of ax + by + c matter?

It shows which side of the line the point is on. Points on the same side give the same sign.

How do I find the distance between two parallel lines?

Pick any point on one line and find its distance to the other, or use |c₁ − c₂| ÷ √(a² + b²) when both lines share a and b.

References & methodology sources

These sources support the calculator’s formula, definitions, thresholds, units or result interpretation.

  1. Weisstein, E. W. (n.d.). Point-line distance—2-dimensional. MathWorld—A Wolfram Web Resource. View source
  2. Abramson, J. (2021). The rectangular coordinate systems and graphs. In College algebra 2e (Section 2.1). OpenStax. View source
  3. Abramson, J. (2021). Precalculus 2e. OpenStax. View source
  4. Abramson, J. (2021). College algebra 2e. OpenStax. View source