Point to Line Distance
Enter the line coefficients a, b, c and a point (x0, y0) to get the shortest, perpendicular distance from the point to the line.
The shortest distance
The distance point to line calculator returns the perpendicular distance — the shortest straight line from the point to the line, measured at a right angle.
General form
Write the line as a·x + b·y + c = 0. A slope-intercept line y = mx + k becomes m·x − y + k = 0, so a = m, b = −1, c = k.
What is the distance from a point to a line?
A perpendicular drop onto the line
The distance point to line calculator finds how far a point sits from a straight line — specifically the perpendicular distance, the length of the shortest segment you can draw from the point to the line. That shortest segment always meets the line at a right angle, which is why every other path to the line is longer. You describe the line in general form, a·x + b·y + c = 0, with three coefficients, and the point with its coordinates (x0, y0). The result is a single non-negative number in the same units as your coordinates. It is the value behind clearance checks, collision margins in graphics and robotics, and the residuals that least-squares line fitting tries to shrink.
Enter the three line coefficients a, b, c and the point coordinates x0 and y0 to get the perpendicular distance instantly.
Take the line's left-hand side at the point, make it positive, and divide by the length of the coefficient vector (a, b).
d = |a·x0 + b·y0 + c| / √(a² + b²)The numerator is the absolute value of a·x0 + b·y0 + c — substitute the point into the line equation and drop the sign, since distance is never negative. The denominator √(a² + b²) normalises by the length of the vector (a, b), which points perpendicular to the line. Divide the two and you have the perpendicular distance.
Suppose the line is 3x + 4y − 5 = 0 and the point is the origin (0, 0).
Substitute the point into the line
3·0 + 4·0 − 5 = −5 — the signed value at the point.
Take the absolute value
The absolute value of −5 is 5 — the numerator, since distance has no sign.
Divide by the vector length
√(3² + 4²) = √25 = 5, so the distance is 5 ÷ 5 = 1 unit.
The number you get is the perpendicular distance — the shortest possible gap between the point and the line, always measured at a right angle to the line. It is reported as a non-negative value: a distance of 0 means the point lies exactly on the line, and any positive number tells you how far off it is, in the same units as your coordinates. The result does not tell you which side of the line the point is on; if you need the side as well, look at the sign of a·x0 + b·y0 + c before taking the absolute value. Scaling the equation does not change the answer — the line 3x + 4y − 5 = 0 and 6x + 8y − 10 = 0 are the same line, and both give the same distance, because the denominator √(a² + b²) grows in step with the numerator. That invariance is exactly what makes this formula the natural measure of how well a straight-line fit matches a scattered point.
The formula is exact, but a couple of conditions have to hold.
General form, a non-negative result, and a real line
This calculator expects the line in general form a·x + b·y + c = 0. The distance it returns is always greater than or equal to zero — it is the perpendicular, unsigned distance, not a position relative to the line. The coefficients a and b cannot both be zero: that leaves no real line and the denominator √(a² + b²) becomes zero, so the calculation is undefined. Convert a y = mx + k line to general form first, with a = m, b = −1, c = k.