Point-to-Line Distance Calculator

Written by Thierno Sadou Diallo, formula verified per our methodology • Last checked on 9/10/2026

The distance from a point (x0,y0) to a line with equation ax + by + c = 0 is calculated with d = |a×x0 + b×y0 + c| ÷ √(a² + b²). For the line 3x + 4y − 6 = 0 and the point (0,0), the distance is 1.2.

Explanation

The distance from a point to a line is the length of the shortest path between the two — a segment always perpendicular to the line, never oblique. This direct formula avoids having to geometrically construct that perpendicular: it is obtained by projecting, via a dot product, the vector connecting any point of the line to the studied point onto the direction perpendicular to the line, given by the vector (a, b) in the general equation ax + by + c = 0. The absolute value in the numerator ensures the distance stays positive, whatever side of the line the point is on, while the division by √(a²+b²) normalizes the result: without it, the result would depend arbitrarily on the scale of the coefficients a, b, and c chosen to write the line's equation (the same line can be written in many equivalent ways, for example 3x+4y−6=0 or 6x+8y−12=0). This general equation ax+by+c=0 follows easily from the slope-intercept form y=mx+b computed by our line equation from two points calculator (just rewrite mx − y + b = 0, that is a=m, b=−1, c=the y-intercept); the result is also directly comparable to a distance between two points, since both are Euclidean distances in the plane, only the reference (another point versus an entire line) differs.

Example: line 3x+4y-6=0, point (0,0)

Inputs

Line equation: 3x + 4y − 6 = 0. Point: (0, 0).

Calculation

d = |3×0 + 4×0 − 6| ÷ √(3² + 4²) = |−6| ÷ √25 = 6 ÷ 5 = 1.2.

Result

The distance between this point and this line is 1.2 (in the units of the coordinates used).

Frequently asked questions

Why is the result always positive?

Because the numerator of the formula uses an absolute value: a distance has no negative meaning, whatever side of the line the point is on. The sign of the expression a×x0+b×y0+c before applying the absolute value does indicate which side of the line the point is on, information sometimes useful separately but not what this calculator displays.

How do you get a, b, and c if you only know the equation y = mx + b in slope-intercept form?

Just move everything to one side of the equality: y = mx + b becomes mx − y + b = 0, which gives a = m, b = −1 (note this "b" of the general equation is not the same number as the y-intercept, despite the same letter), and c = the y-intercept of the slope-intercept form.

What does a distance of zero mean?

A zero distance means the point lies exactly on the line: its coordinates satisfy the equation a×x0+b×y0+c=0, so the numerator of the formula vanishes completely even before the division.

Related resources

Similar calculators