📏Point-to-Line Distance Calculator

Calculate the shortest distance between a point and a line from the line's equation and the point's coordinates

a
b
c
x0
y0

How to Use the Point-to-Line Distance Calculator

The shortest distance from a point to a line is the length of the segment dropped perpendicularly from that point onto the line. This calculator takes the line's equation in general form, ax+by+c=0, plus a point's coordinates (x0, y0), and instantly returns the shortest distance between them. If your line is given as y=mx+k, rewrite it as mx-y+k=0 first, so a=m, b=-1, c=k.

The formula is distance = |a×x0 + b×y0 + c| ÷ √(a²+b²). The absolute value in the numerator ensures the distance is always positive regardless of which side of the line the point falls on, while dividing by √(a²+b²) normalizes the result so it doesn't depend on how the equation's coefficients happen to be scaled. If the point lies exactly on the line, the numerator evaluates to 0 and the distance comes out as 0.

This formula shows up well beyond geometry homework — game developers use it for collision distances between a character and a wall, and mapping applications use it to estimate how far a point is from the nearest road segment. Just remember that a and b can't both be 0, since that would mean the equation no longer describes a line at all.

Frequently Asked Questions

What do a, b, and c mean?

They're the coefficients of the line's equation ax+by+c=0. For example, y=2x+3 rewrites to 2x-y+3=0, so a=2, b=-1, c=3.

Why can't I calculate a distance when a and b are both 0?

If a and b are both 0, ax+by+c=0 is no longer a valid line equation, so a distance can't be calculated.