Point Line Distance 2D Calculator
Computes distance from a point to a line in the plane given line coefficients a x plus b y plus c equals zero and point coordinates.
—
Distance from a point to a line in 2D
Take a line in general form a·x + b·y + c = 0 and a point P = (x₀, y₀). The perpendicular distance from P to the line is d = |a·x₀ + b·y₀ + c| / √(a² + b²). Up top you have the signed value of the line equation evaluated at P, which is zero exactly when P sits on the line. Dividing by √(a² + b²) scales the normal vector (a, b) down to unit length. Try it: the distance from P = (1, 2) to the line x + y − 3 = 0 is |1 + 2 − 3| / √(1² + 1²) = 0 / √2 = 0, so P lands right on the line. Move to P = (4, 5) with the same line and you get |4 + 5 − 3| / √2 = 6/√2 ≈ 4.243.
Applications
It shows up in GIS proximity queries (how far is a building from the nearest road centreline?), CAD geometric constraints like snap-to-line and perpendicularity, and computer graphics for anti-aliasing thin lines. In linear regression the residuals are vertical distances to the fitted line, while orthogonal regression reaches for this formula directly. You'll also see it in Hough transform peak detection and in robotics path planning, where it measures clearance from a wall modelled as a line.
FAQ
What if I have the line in slope-intercept form y = m·x + k? Rearrange it to m·x − y + k = 0, so a = m, b = −1, c = k. That gives d = |m·x₀ − y₀ + k| / √(m² + 1).
What if a = b = 0? Then the "line" collapses. There's no line at all, only the equation c = 0, and the formula ends up dividing by zero. Reject the input as invalid.
How do I find the foot of the perpendicular? The point on the line nearest to P is P − ((a·x₀ + b·y₀ + c)/(a² + b²)) · (a, b). Keep the same scalar but drop the absolute value and you get a signed projection along the normal.
Related Tools
Inverse Square Law (Radiation)
Compute the radiation intensity at a new distance from a point source, I₂ = I₁·(d₁/d₂)², by the inverse square law: intensity falls with the square of distance. Doubling the distance reduces the dose to a quarter — which is why distance is one of the three basic radiation-protection defenses (time, distance and shielding) and the most effective and cheapest. Enter the initial intensity and distance and the new distance.
Compass Orientation Distance
Computes meters of drift between true and magnetic north for a given walk.
Flash Guide Number by Distance
Returns ideal aperture from flash Guide Number and subject distance.
Break-even Calculator
Find how many units you must sell to cover fixed and variable costs (break-even). Shows break-even in units and revenue, with contribution margin. Everything in your browser.
APS-C to Full Frame Focal Equivalence
Converts APS-C focal length to FF equivalent at 1.5x crop factor.
Vehicle Braking Distance
Calculates braking distance d=v²/(2·µ·g) in meters from speed and friction coefficient.
The results provided by this tool are for general informational and educational purposes only and do not constitute professional, financial, medical, legal, tax or accounting advice. Always confirm important decisions with a qualified professional and official sources.