Connect via MCP →

Enter Calculation

Line in general form: a·x + b·y + c = 0

Formula

Advertisement

Results

Distance from Point to Line
1
units
Signed distance -1
Numerator |a·x₀ + b·y₀ + c| 5
Denominator √(a² + b²) 5

What this calculator does

This tool computes the shortest (perpendicular) distance from a point to a straight line in the two-dimensional plane. The line is given in general form, \(a\cdot x + b\cdot y + c = 0\), and the point is given by its coordinates \((x_0, y_0)\). The result is always a non-negative length measured perpendicular to the line.

How to use it

Enter the three coefficients a, b and c of your line equation, then enter the coordinates of your point. Click calculate. If you have a line in slope-intercept form like \(y = m\cdot x + k\), rewrite it as \(m\cdot x - y + k = 0\), so \(a = m\), \(b = -1\) and \(c = k\).

The formula explained

The distance is $$d = \frac{\left| a\,x_0 + b\,y_0 + c \right|}{\sqrt{a^{2} + b^{2}}}$$ The numerator measures how far the point's coordinates are from satisfying the line equation, and dividing by \(\sqrt{a^{2} + b^{2}}\) normalizes that by the magnitude of the line's normal vector \((a, b)\). The absolute value guarantees a positive distance; dropping it gives a signed value whose sign indicates which side of the line the point is on.

Advertisement
Diagram showing the perpendicular distance from a point to a straight line in 2D
The distance d is the length of the perpendicular segment from point \((x_0, y_0)\) to the line.

Worked example

Take the line \(3x + 4y - 5 = 0\) and the point \((0, 0)\). The numerator is \(\left| 3\cdot 0 + 4\cdot 0 - 5 \right| = 5\). The denominator is \(\sqrt{3^{2} + 4^{2}} = \sqrt{25} = 5\). So $$d = \frac{5}{5} = 1.$$ The origin lies exactly one unit from this line.

Worked example showing a point, a specific line, and the perpendicular distance between them
Worked example: dropping a perpendicular from the point to the line on a coordinate grid.

FAQ

What if a and b are both zero? Then \(a\cdot x + b\cdot y + c = 0\) is not a valid line, so distance is undefined; the calculator returns 0 to avoid dividing by zero.

Does the sign of d matter? The main distance is always positive. The signed distance row tells you which half-plane the point falls in — positive on one side, negative on the other.

Can I use this for a line through two points? Yes — convert the two points \((x_1,y_1)\) and \((x_2,y_2)\) into \(a = y_2-y_1\), \(b = x_1-x_2\), \(c = x_2\cdot y_1 - x_1\cdot y_2\), then enter those coefficients.

Last updated: