No ads, no sign-upChecked 2026-08-24

Distance from a Point to a Line

Your numbers

Change any value to update the result.

Distance to the line

1.000000

Distance to the line: 1.000000
Examples

Write the line as a·x + b·y + c = 0, put the point into the left-hand side, take the absolute value and divide by √(a² + b²). For 3x + 4y − 5 = 0 and the origin that is 5 ÷ 5 = 1. A line given as y = mx + k becomes a = m, b = −1, c = k.

The numbers at a glance

Held fixed: Coefficient a 3.0000, Coefficient b 4.0000, Constant c -5.0000, Point x-coordinate (x₀) 0.0000.

Point y-coordinate (y₀)Distance to the line
-0.00041.000320
-0.00021.000160
0.0000Your value1.000000
0.00020.999840
0.00040.999680

Worked examples

Case 1

Coefficient a
3
Coefficient b
4
Constant c
-5
Point x-coordinate (x₀)
0
Point y-coordinate (y₀)
0

1.000000

Open with these values

Case 2

Coefficient a
5
Coefficient b
-12
Constant c
2
Point x-coordinate (x₀)
1
Point y-coordinate (y₀)
1

0.384615

Open with these values

Case 3

Coefficient a
1
Coefficient b
2
Constant c
2
Point x-coordinate (x₀)
-3
Point y-coordinate (y₀)
-4

4.024922

Open with these values

How it's calculated

d = |a·x₀ + b·y₀ + c| ÷ √(a² + b²)

  1. StepBring the line into the form a·x + b·y + c = 0 and enter a, b and c.
  2. StepEnter the coordinates of the point.
  3. ResultThe point goes into the left-hand side; the absolute value is divided by √(a² + b²).1.000000

Reference table

a, b, c, x₀, y₀Numerator ÷ denominatorDistance
3, 4, -5, 3, -10 ÷ 50.000000
1, 1, 0, 3, -30 ÷ √20.000000
5, -12, 2, 1, 15 ÷ 130.384615
3, 4, -5, 0, 05 ÷ 51.000000
1, 2, 2, -3, -49 ÷ √54.024922
0, 1, -3, 2, 74 ÷ 14.000000

Questions

How do I calculate the distance from a point to a line?

Write the line in general form a·x + b·y + c = 0, then use d = |a·x₀ + b·y₀ + c| ÷ √(a² + b²). For the line 3x + 4y − 5 = 0 and the origin that is |−5| ÷ √25 = 1.

My line is y = mx + k — how do I use this calculator?

Move everything to one side: m·x − y + k = 0. So a = m, b = −1 and c = k. The line y = 2x + 1 becomes a = 2, b = −1, c = 1.

What does perpendicular distance mean here?

It is the shortest straight-line gap between the point and the line, measured along a segment that meets the line at a right angle. Every other path from the point to the line is longer.

Why does the formula use absolute value?

Because a distance is never negative. The expression a·x₀ + b·y₀ + c comes out positive or negative depending on which side of the line the point lies, so the absolute value strips the sign. Check that sign before taking it if you need the side.

What happens if a and b are both zero?

Then a·x + b·y + c = 0 describes no line at all and the denominator √(a² + b²) is zero, so the distance is undefined. At least one of a and b must be non-zero, and the calculator shows no result otherwise.

Sources and last check

  1. mathworld.wolfram.com

Information, not professional advice.