What this calculator does
This tool finds the shortest (perpendicular) distance from a point (x₀, y₀) to a straight line written in the general form \(ax + by + c = 0\). The shortest distance is always measured along the perpendicular dropped from the point to the line, and it is a single positive number measured in the same units as your coordinates. The calculator is a pure geometry tool, so it works for any coordinate system or unit.
How to use it
First write your line in general form. If you have slope-intercept form \(y = mx + k\), rearrange it to \(mx - y + k = 0\), so \(a = m\), \(b = -1\), \(c = k\). Enter the coefficients \(a\), \(b\) and \(c\), then enter the point's coordinates \(x_0\) and \(y_0\). Press calculate to see the perpendicular distance, the signed distance (which keeps the sign), and the value of \(\sqrt{a^{2} + b^{2}}\).
The formula explained
The line \(ax + by + c = 0\) has the vector \((a, b)\) as its normal direction. The expression \(a \cdot x_0 + b \cdot y_0 + c\) measures how far the point sits along that normal, but it is scaled by the length of the normal vector. Dividing by \(\sqrt{a^{2} + b^{2}}\) normalises this so the result is a true distance. Taking the absolute value gives the unsigned perpendicular distance:
$$d = \frac{\left| \text{a} \cdot \text{x}_0 + \text{b} \cdot \text{y}_0 + \text{c} \right|}{\sqrt{\text{a}^{2} + \text{b}^{2}}}$$
Worked example
Line: \(3x + 4y - 5 = 0\), so \(a = 3\), \(b = 4\), \(c = -5\). Point: \((0, 0)\). Numerator \(= |3 \cdot 0 + 4 \cdot 0 - 5| = |-5| = 5\). Denominator \(= \sqrt{3^{2} + 4^{2}} = \sqrt{25} = 5\). Distance \(= 5 / 5 =\) 1.
$$d = \frac{\left| 3 \cdot 0 + 4 \cdot 0 - 5 \right|}{\sqrt{3^{2} + 4^{2}}} = \frac{5}{5} = 1$$FAQ
What does the signed distance mean? A positive or negative signed value tells you which side of the line the point is on; points on opposite sides have opposite signs.
What if a and b are both zero? Then \(ax + by + c = 0\) is not a valid line and the distance is undefined — the calculator returns 0 to avoid dividing by zero.
Can I use this in 3D? No, this formula is for a point and a line in the 2D plane. Distance from a point to a line in 3D uses a cross-product formula instead.