Distance from a Point to a Line

Calculate the perpendicular distance from a point to a line given the line's equation in standard form and a point's coordinates.

d=Ax0+By0+CA2+B2d = \frac{|Ax_0 + By_0 + C|}{\sqrt{A^2 + B^2}}

Solve a problem with Distance from a Point to a Line

Type the problem. The solver will use Distance from a Point to a Line where Distance from a Point to a Line is the right tool, and tell you when it is not.

Drag one in or paste from the clipboard. JPEG, PNG or WebP. You get the transcription to check before anything is solved.

How to get a better answer
  • Paste the whole problem, including the instruction word — "simplify", "solve for x" and "factor" lead to three different answers.
  • Say what you have already tried. "I got x = 4 and the book says 2" turns a solution into a diagnosis.
  • Set the level in the settings button. A calculus shortcut is not a better answer if you have not met derivatives yet.
  • For a photo, get the whole problem in frame and hold the page flat — you get the transcription to fix before anything is solved.

What each symbol means

What Distance from a Point to a Line takes
AA
BB
CC
x0x_0
y0y_0
dd
Distance from a Point to a Line
SymbolMeaning
AAThe coefficient of xx in the line equation Ax+By+C=0Ax + By + C = 0; must be a real number.
BBThe coefficient of yy in the line equation; must be a real number (at least one of AA and BB must be non-zero for a valid line).
CCThe constant term in the line equation Ax+By+C=0Ax + By + C = 0; can be any real number, including zero.
x0x_0The xx-coordinate of the point whose distance to the line you are measuring.
y0y_0The yy-coordinate of the point whose distance to the line you are measuring.
ddThe perpendicular distance from the point to the line; always non-negative (zero if the point is on the line, positive otherwise).

When to use it

You should use this formula whenever you need to find the shortest perpendicular distance from a specific point to a straight line.

Level

Usually taught in: Pre-Calculus

Worked examples

1. Distance from the origin to a line with integer coefficients

Problem

Find the distance from the point (0,0)(0, 0) to the line 3x+4y12=03x + 4y - 12 = 0.
  1. A=3,B=4,C=12,(x0,y0)=(0,0)A = 3, B = 4, C = -12, (x_0, y_0) = (0, 0)

    We identify each coefficient from the equation 3x+4y12=03x + 4y - 12 = 0 and the given point coordinates.

  2. d=3(0)+4(0)1232+42d = \frac{|3(0) + 4(0) - 12|}{\sqrt{3^2 + 4^2}}

    Substituting these values into the formula d=Ax0+By0+CA2+B2d = \frac{|Ax_0 + By_0 + C|}{\sqrt{A^2 + B^2}}.

  3. d=1225=125d = \frac{|-12|}{\sqrt{25}} = \frac{12}{5}

    Simplifying the numerator to 12=12|-12| = 12 and the denominator to 9+16=25=5\sqrt{9 + 16} = \sqrt{25} = 5.

Answer: d=125 or 2.4 unitsd = \frac{12}{5} \text{ or } 2.4 \text{ units}

This is a straightforward application where all values are small integers. The formula directly gives us the perpendicular distance from the origin to the line.

2. Distance with negative coefficients and rationalization

Problem

Find the distance from the point (3,1)(-3, 1) to the line x2y+4=0x - 2y + 4 = 0.
  1. A=1,B=2,C=4,(x0,y0)=(3,1)A = 1, B = -2, C = 4, (x_0, y_0) = (-3, 1)

    We extract the coefficients from x2y+4=0x - 2y + 4 = 0; notice that B=2B = -2 is negative.

  2. d=1(3)+(2)(1)+412+(2)2d = \frac{|1(-3) + (-2)(1) + 4|}{\sqrt{1^2 + (-2)^2}}

    Substituting into the formula, paying careful attention to the negative sign in front of the yy coefficient and coordinate.

  3. d=32+41+4=15=15d = \frac{|-3 - 2 + 4|}{\sqrt{1 + 4}} = \frac{|-1|}{\sqrt{5}} = \frac{1}{\sqrt{5}}

    Simplifying: 32+4=1-3 - 2 + 4 = -1, so 1=1|-1| = 1, and 1+4=51 + 4 = 5.

  4. d=55d = \frac{\sqrt{5}}{5}

    We rationalize the denominator by multiplying by 55\frac{\sqrt{5}}{\sqrt{5}} to eliminate the square root from the bottom.

Answer: d=55 (approximately 0.447 units)d = \frac{\sqrt{5}}{5} \text{ (approximately 0.447 units)}

This example shows how negative coefficients are handled—they work the same way as positive ones, and the absolute value ensures the final distance is positive. Rationalizing the denominator gives an exact form.

3. Real-world problem: Finding distance to a marked line

Problem

The school bake sale is set up along a line on the gym floor marked by the equation 2x+3y18=02x + 3y - 18 = 0 (where distances are in meters). A student drops a cookie at position (3,1)(3, 1). What is the perpendicular distance from the cookie to the bake sale line?
  1. A=2,B=3,C=18,(x0,y0)=(3,1)A = 2, B = 3, C = -18, (x_0, y_0) = (3, 1)

    From the line 2x+3y18=02x + 3y - 18 = 0 and the cookie position, we identify all the required coefficients and coordinates.

  2. d=2(3)+3(1)1822+32d = \frac{|2(3) + 3(1) - 18|}{\sqrt{2^2 + 3^2}}

    Substituting our values into the distance formula.

  3. d=6+3184+9=913=913d = \frac{|6 + 3 - 18|}{\sqrt{4 + 9}} = \frac{|-9|}{\sqrt{13}} = \frac{9}{\sqrt{13}}

    We compute: 23=62 \cdot 3 = 6, 31=33 \cdot 1 = 3, and 6+318=96 + 3 - 18 = -9, with absolute value 99 and denominator 13\sqrt{13}.

  4. d=91313d = \frac{9\sqrt{13}}{13}

    Rationalizing by multiplying numerator and denominator by 13\sqrt{13} gives the exact distance in meters.

Answer: d=91313 meters (approximately 3.16 meters)d = \frac{9\sqrt{13}}{13} \text{ meters (approximately 3.16 meters)}

This practical example shows how to apply the formula to a real situation. The answer tells us the cookie is about 3.16 meters away from the bake sale line.

Common mistakes

Where Distance from a Point to a Line usually goes wrong
Answer came out wrong
Using A2+B2A^2 + B^2 instead of A2+B2\sqrt{A^2 + B^2} in the denominator
Always remember that the denominator is A2+B2\sqrt{A^2 + B^2}; the square root is essential and cannot be omitted.
Writing d=Ax0+By0+CA2+B2d = \frac{Ax_0 + By_0 + C}{\sqrt{A^2 + B^2}} without absolute value bars in the numerator
The correct formula is d=Ax0+By0+CA2+B2d = \frac{|Ax_0 + By_0 + C|}{\sqrt{A^2 + B^2}} with absolute value bars around the entire numerator.
Trying to use the formula with a line in slope-intercept form like y=2x+3y = 2x + 3 without converting to standard form
Convert y=2x+3y = 2x + 3 to 2xy+3=02x - y + 3 = 0 by rearranging, then use the formula with A=2A = 2, B=1B = -1, C=3C = 3.
The mistakeWhy it is wrongThe fix
Using A2+B2A^2 + B^2 instead of A2+B2\sqrt{A^2 + B^2} in the denominatorThe denominator is a square root because it represents the magnitude of the normal vector to the line, derived from the Pythagorean theorem.Always remember that the denominator is A2+B2\sqrt{A^2 + B^2}; the square root is essential and cannot be omitted.
Writing d=Ax0+By0+CA2+B2d = \frac{Ax_0 + By_0 + C}{\sqrt{A^2 + B^2}} without absolute value bars in the numeratorDistance is always non-negative, but Ax0+By0+CAx_0 + By_0 + C can be negative depending on which side of the line the point lies on.The correct formula is d=Ax0+By0+CA2+B2d = \frac{|Ax_0 + By_0 + C|}{\sqrt{A^2 + B^2}} with absolute value bars around the entire numerator.
Trying to use the formula with a line in slope-intercept form like y=2x+3y = 2x + 3 without converting to standard formThe formula requires standard form Ax+By+C=0Ax + By + C = 0 so that AA, BB, and CC are clearly identified.Convert y=2x+3y = 2x + 3 to 2xy+3=02x - y + 3 = 0 by rearranging, then use the formula with A=2A = 2, B=1B = -1, C=3C = 3.

Tips and when to use something else

  • If you only need to rank which of several points is closest to a line, compare the values of Ax0+By0+C|Ax_0 + By_0 + C| directly—you don't always need to compute the full distances.
  • When a line equation is given in slope-intercept form y=mx+by = mx + b, rewrite it as mxy+b=0mx - y + b = 0 to get standard form before applying the formula.
  • The distance will be zero if and only if the point lies on the line, which happens when Ax0+By0+C=0Ax_0 + By_0 + C = 0.
  • Don't confuse this formula with the Distance Formula (which finds distance between two points); this measures distance from a point to an entire line.

Frequently asked questions

How is the distance from a point to a line different from the Distance Formula?
The Distance Formula finds the distance between two specific points. Distance from a point to a line finds the shortest distance from that point to any point on the line. The shortest distance is always along the perpendicular from the point to the line, which makes this a geometrically different problem.
What does the absolute value in the numerator do?
Distance must always be non-negative or zero. The expression Ax0+By0+CAx_0 + By_0 + C can be negative depending on which side of the line the point is located. The absolute value ensures that the result is always non-negative, matching the geometric definition of distance.
Can I use this formula if my line is written as y=mx+by = mx + b?
Not directly. You must first convert to standard form Ax+By+C=0Ax + By + C = 0. For example, y=2x+3y = 2x + 3 becomes 2xy+3=02x - y + 3 = 0. Once in standard form, identify A=2A = 2, B=1B = -1, C=3C = 3 and apply the formula.
What does it mean if the distance comes out to be zero?
A distance of zero means the point lies exactly on the line. Geometrically, this makes sense—if you're standing on a line, your distance to that line is zero. This happens when the point coordinates satisfy the line equation, so Ax0+By0+C=0Ax_0 + By_0 + C = 0.

Need a different method?

The full solver is not scoped to one formula — type any problem and it will pick the method.

Open the math solver

Reviewed 2026-09-18