Connect via MCP →

Enter Calculation

Line: a·x + b·y + c = 0

Formula

Advertisement

Results

Perpendicular Distance
1.2
units
Signed distance 1.2
√(a²+b²) 5

What is the point-to-line distance?

The perpendicular distance from a point to a line is the length of the shortest segment connecting the point to the line — measured along a path perpendicular to the line. Given a line written in general form \(ax + by + c = 0\) and a point \((x_0, y_0)\), this calculator returns that shortest distance instantly. It is a fundamental tool in coordinate geometry, computer graphics, robotics path planning, and physics.

A point and a straight line with a perpendicular dropped from the point to the line
The distance from a point to a line is the length of the perpendicular segment.

How to use the calculator

Enter the three coefficients a, b, and c of your line in general form. If your line is given as \(y = mx + k\), rewrite it as \(mx - y + k = 0\), so \(a = m\), \(b = -1\), \(c = k\). Then enter the point's coordinates \(x_0\) and \(y_0\). The result shows the absolute perpendicular distance, plus the signed value, which tells you which side of the line the point sits on (positive vs. negative).

The formula explained

The formula $$d = \frac{\left| a\,x_0 + b\,y_0 + c \right|}{\sqrt{a^{2} + b^{2}}}$$ works by plugging the point into the line equation. If the point were on the line, \(ax_0 + by_0 + c\) would equal zero. The further off the line, the larger this value. Dividing by \(\sqrt{a^2 + b^2}\) — the magnitude of the normal vector \((a, b)\) — normalizes the result into true distance units.

Advertisement
Diagram showing the components of the point to line distance formula
The formula uses the point coordinates and the line's a, b, c coefficients.

Worked example

For the line \(3x + 4y - 5 = 0\) and the point \((1, 2)\): numerator \(= |3\cdot 1 + 4\cdot 2 - 5| = |3 + 8 - 5| = 6\). Denominator \(= \sqrt{3^2 + 4^2} = \sqrt{25} = 5\). So $$d = \frac{6}{5} = \textbf{1.2 units}.$$

FAQ

What if a and b are both zero? Then there is no valid line and the distance is undefined; the calculator returns 0 to avoid dividing by zero.

What does the signed distance mean? Its sign indicates which side of the line the point is on — useful for orientation tests and half-plane checks.

Can I use it for a horizontal or vertical line? Yes. A vertical line \(x = k\) is \(x - 0\cdot y - k = 0\) (\(a=1\), \(b=0\), \(c=-k\)); a horizontal line \(y = k\) is \(0\cdot x + y - k = 0\).

Last updated: