Math
Distance from Point to Line Calculator
Enter a point and a line in any form and mathcheck computes the shortest (perpendicular) distance with an exact simplified radical and a decimal.
It also gives the foot of the perpendicular, the perpendicular line itself, and every step of |Ax0 + By0 - C| / sqrt(A^2 + B^2). Switch to 3D for the distance from a point to a plane.
x-coordinate of the point.
y-coordinate of the point.
Coefficient of x.
Coefficient of y.
Constant term. In Ax + By = C it sits on the right side; in Ax + By + C = 0 it is on the left.
Try an example
Result
Distance
—
- Decimal
- —
- Closest point (foot of the perpendicular)
- —
- Line or plane
- —
- Perpendicular through the point / normal
- —
Student quick launch
Grade planning, algebra checks, and formulas students reach for most.
Study path
Use this calculator with
Follow these when you want the formula behind the answer, a short lesson, or nearby tools in the same topic.
The point-to-line distance formula
The distance from a point to a line means the shortest distance, measured along the perpendicular from the point to the line. Write the line as Ax + By + C = 0 (or Ax + By = C), substitute the point into the left side, take the How far a number sits from zero, so the answer is never negative., and divide by the length of the normal A quantity with both a size and a direction, often drawn as an arrow. sqrt(A^2 + B^2).
Worked example
Distance from (2, 3) to 3x + 4y = 5
Rewrite as 3x + 4y - 5 = 0. Numerator: |3(2) + 4(3) - 5| = |13| = 13. Denominator: sqrt(3^2 + 4^2) = 5. Distance = 13/5 = 2.6. The foot of the perpendicular is (11/25, 23/25).
| Line given as | First convert to | Then |
|---|---|---|
| y = mx + b | mx - y + b = 0 (A = m, B = -1, C = b) | apply the formula |
| Two points | slope, then standard form | apply the formula |
| Vertical x = k | distance is just |x0 - k| | no formula needed |
| Horizontal y = k | distance is just |y0 - k| | no formula needed |
How to use this calculator
- Choose 2D for a point and a line, or 3D for a point and a plane.
- Enter the point's coordinates.
- Enter the line in whatever form you have (standard form is fastest), or the plane's A, B, C, D.
- Read the distance as an exact radical or fraction with its decimal.
- Use the foot of the perpendicular if you need the closest point, and Show the work for the formula steps.
How to read the answer
The distance is always non-negative; the absolute value in the The top number of a fraction; it counts how many parts you have. removes the sign. A distance of 0 means the point is on the line or plane. The foot of the perpendicular is the point on the line closest to your point, and the segment joining them is perpendicular to the line, so it also gives you the height of a triangle when the line contains the base.
Common mistakes and edge cases
- Forgetting to move everything to one side before substituting. 3x + 4y = 5 must become 3x + 4y - 5 = 0.
- Dropping the absolute value and reporting a negative distance.
- Using sqrt(A + B) instead of sqrt(A^2 + B^2) in the denominator.
- Measuring vertically (difference in y) instead of perpendicularly; that gives a larger number unless the line is horizontal.
- Mixing up the 2D formula with the 3D plane formula; the plane version needs a third The number multiplying a variable, like the 3 in 3x. and coordinate.
Worked examples
Textbook case
(2, 3) to 3x + 4y = 5
Distance
13/5 (2.6)
Radical answer
Origin to y = 2x + 3
Distance
3√5/5 (1.3416)
Line from two points
(4, -1) to the line through (0, 0) and (3, 3)
Distance
5√2/2 (3.5355)
Point on the line
(1, 5) to y = 2x + 3
Distance
0
Vertical line
(-3, 7) to x = 2
Distance
5
Point to plane
(1, 2, 3) to 2x - y + 2z - 4 = 0
Distance
2/3 (0.6667)
Degenerate plane
Distance
—
Frequently asked questions
What is the formula for the distance from a point to a line?+
For the line Ax + By + C = 0 and the point (x0, y0), d = |A x0 + B y0 + C| / sqrt(A^2 + B^2). It measures the perpendicular (shortest) distance.
How do I use the formula when the line is y = mx + b?+
Rewrite it as mx - y + b = 0, so A = m, B = -1, and C = b. Then d = |m x0 - y0 + b| / sqrt(m^2 + 1).
Why is the distance measured perpendicularly?+
The perpendicular segment is the shortest path from the point to the line. Any other segment from the point to the line is the hypotenuse of a right triangle whose leg is the perpendicular, so it is longer.
What is the foot of the perpendicular?+
The point on the line where the perpendicular from your point lands. It is the closest point on the line to your point, and the calculator gives its exact coordinates.
How is the distance from a point to a plane different?+
The idea is the same but with three coordinates: d = |A x0 + B y0 + C z0 + D| / sqrt(A^2 + B^2 + C^2) for the plane Ax + By + Cz + D = 0.
Can the distance be negative?+
No. The absolute value in the numerator makes the distance zero or positive. A zero distance means the point is on the line.
About this calculator
- Written by
- mathcheck editorial team
- Last reviewed
- September 4, 2026
Method
- Uses the values entered by the user and stable formulas documented on the page.
Related calculators
Perpendicular Line Calculator
Find the equation of the line perpendicular to a given line through a point using the negative reciprocal slope. Accepts any line form, graphs both lines, and shows where they meet at a right angle.
Distance Formula Calculator
Find the distance between two coordinate points with dx, dy, squared distance, and square-root steps.
Parallel Line Calculator
Find the equation of the line parallel to a given line through a point. Accepts y = mx + b, two points, point-slope, or standard form, and graphs both lines with the distance between them.
3D Distance Calculator
Find the distance between two points in 3D space with the exact radical form and decimal, plus the midpoint, the direction vector from P to Q, its unit vector, and direction angles.
Slope Intercept Form Calculator
Write the equation of a line in slope-intercept form y = mx + b from two points, a point and a slope, or standard form. Exact fractions, intercepts, a graph, and every other form of the line.
Midpoint Calculator
Find the midpoint between two coordinate points with coordinate-average steps.
Last updated: September 4, 2026