Skip to content
CalculatorZilo Logo
  • Home
  • CalculatorsExpand
    • Browse all calculators
    • Education
    • Real Estate
    • Chemistry
  • Finance
  • Math
  • Health & Fitness
  • Science
  • About
  • Contact
CalculatorZilo Logo
Home / Distance From Point to Line Calculator
Geometry Calculators

Distance From Point to Line Calculator

Published onJune 27, 2025 Updated onOctober 21, 2026 5:51 am

The shortest distance from a point to a line is always the perpendicular one: the segment that meets the line at a right angle, ending at the closest point on the line. This calculator finds that distance in the 2D plane from a line given in general form, through two points, or in slope-intercept form.

It also shows every substitution step and returns the exact coordinates of the foot of the perpendicular, so you get the closest point itself, not just a number. The three entry modes describe the same line in different ways, and the worked example below proves they agree.

Distance From Point to Line Calculator
Perpendicular distance with steps and foot coordinates, in 2D

Line: ax + by + c = 0

Line through two points

Line: y = mx + b

Results


The line is treated as infinite in both directions, not as a segment between two points. Results use the same units as your coordinates.

Quick Answer

Quick answer: the distance from the point (1, 1) to the line 3x + 4y - 10 = 0 is 0.6000 units. The numerator is |3 x 1 + 4 x 1 - 10| = 3, the denominator is sqrt(9 + 16) = 5, and 3 / 5 = 0.6. The closest point on the line, the foot of the perpendicular, is (1.3600, 1.4800). The calculator above is pre-filled with these numbers, so one click on Calculate reproduces them in any of the three modes.

Key takeaways

  • One formula covers every mode: d = |a x0 + b y0 + c| / sqrt(a^2 + b^2). Two points and slope-intercept entry are converted to general form first, which is why all three modes return 0.6000 on the worked example.
  • The denominator matters as much as the numerator. Doubling every coefficient (6x + 8y - 20 = 0) describes the same line and doubles the numerator, but the denominator doubles too, so the distance is unchanged.
  • The foot of the perpendicular, (1.3600, 1.4800) in the example, is a checkable answer: it lies on the line, and its distance from (1, 1) is exactly the reported 0.6000.
  • A vertical line such as x = 3 needs general form (a = 1, b = 0, c = -3). Slope-intercept form cannot describe it, because a vertical line has no slope.
On this page
  • Quick Answer
  • Choosing the right mode for your line
  • The formula, and why it works
  • Worked example: 3x + 4y - 10 = 0 and the point (1, 1)
  • The foot of the perpendicular: the closest point itself
  • Line in 2D or plane in 3D: picking the right calculator
  • Common mistakes that change the answer
  • What competing calculators miss
  • Frequently Asked Questions
  • Add This Calculator to Your Website
  • References

Choosing the right mode for your line

Pick the tab that matches how your line is given. All three feed the same formula, so the choice is about convenience, not about getting a different answer.

1

General form fits a line already written as ax + by + c = 0, the form most textbooks and exam questions use. Copy a, b and c across with their signs, including a negative c.

2

Two points fits a line you know from two coordinates it passes through, such as the ends of a wall, a road centerline on a map, or two plotted data points. The tool converts the pair to general form for you.

3

Slope-intercept fits a line given as y = mx + b, the form graphing and regression work usually produce. The tool converts it with a = m, b coefficient = -1 and c = the intercept.

4

Then enter the point. The point fields (x0, y0) sit below the tabs and stay the same whichever mode you pick, so you can switch modes and compare without retyping the point.

The formula, and why it works

The formula: for the line ax + by + c = 0 and the point (x0, y0), d = |a x0 + b y0 + c| / sqrt(a^2 + b^2). The foot of the perpendicular is (x0 - a s, y0 - b s), where s = (a x0 + b y0 + c) / (a^2 + b^2) is the signed version of the same calculation, without the absolute value.

The vector (a, b) is the line's normal: it points straight out of the line, at a right angle to it. Plugging the point into the line equation measures how far the point sits along that normal direction, but in units scaled by the normal's length. Dividing by sqrt(a^2 + b^2), the length of (a, b), removes the scaling and leaves a true distance. This is the same normalization behind the Hesse normal form on Wikipedia, where the line is written with a unit normal so the equation itself reads off signed distances directly.

The sign of a x0 + b y0 + c, before the absolute value, also tells you which side of the line the point is on: positive on the side the normal points toward, negative on the other side, and zero when the point lies on the line itself. The calculator reports the distance as a positive length, but the foot calculation keeps the sign, because the foot is reached by walking from the point back along the normal by exactly that signed amount.

Worked example: 3x + 4y - 10 = 0 and the point (1, 1)

The calculator is pre-filled with this case in all three modes, and every figure below is what it returns.

StepSubstitutionResult
Numerator|3 x 1 + 4 x 1 - 10| = |-3|3.0000
Denominatorsqrt(3^2 + 4^2) = sqrt(9 + 16) = sqrt(25)5.0000
Distance3.0000 / 5.00000.6000 units
Foot of the perpendicular(1 - 3 x -0.12, 1 - 4 x -0.12), with s = -3 / 25 = -0.12(1.3600, 1.4800)
0.6000
Perpendicular distance, in units
(1.3600, 1.4800)
Foot of the perpendicular
5.0000
Normal length, sqrt(a^2 + b^2)
3
Entry modes, one identical answer

The same line in the other two modes gives the same result, which is the real test that the conversions are right. Through the points (0, 2.5) and (4, -0.5), the conversion produces a = -0.5 - 2.5 = -3, b = 0 - 4 = -4 and c = 4 x 2.5 - 0 x -0.5 = 10: the line -3x - 4y + 10 = 0, which is the example line multiplied by -1, so the distance is again 0.6000 and the foot is again (1.3600, 1.4800). As y = -0.75x + 2.5, the conversion gives a = -0.75, b = -1 and c = 2.5, a scaled copy of the same line, with the same answer.

Two checks confirm the foot. First, it lies on the line: 3 x 1.36 + 4 x 1.48 - 10 = 4.08 + 5.92 - 10 = 0. Second, the gap between the point and the foot equals the reported distance: sqrt((1.36 - 1)^2 + (1.48 - 1)^2) = sqrt(0.1296 + 0.2304) = sqrt(0.36) = 0.6. If either check fails on your own numbers, an input sign is usually wrong.

The foot of the perpendicular: the closest point itself

The distance alone answers "how far?" The foot answers "where?" It is the projection of your point onto the line, and it is the point you actually need in several common jobs. Reflecting a point across a line uses the foot as the midpoint of the point and its mirror image. Finding the closest point on a road, a property boundary or a fitted regression line to an off-line location is a foot calculation. Least squares fitting, the line of best fit through scattered data, is built by minimizing exactly these perpendicular gaps in aggregate, the idea behind perpendicular regression as described in the perpendicular distance article on Wikipedia.

One honest boundary: the foot is the closest point on the infinite line. If your real problem is a segment, such as the side of a plot between two corners, and the foot falls outside the segment's ends, the closest segment point is the nearer endpoint instead, and the answer becomes a plain point to point distance. The calculator measures to the line, so check where the foot lands before using it as a segment answer.

Line in 2D or plane in 3D: picking the right calculator

These two pages are a pair, and they are easy to confuse because the formulas look alike. This page is strictly 2D: a point (x0, y0), a line, and a normal vector with two components. When your point has a z coordinate and the target is a flat surface in space rather than a line on a page, the matching tool is the distance from point to plane calculator, which adds the third term to both the numerator and the denominator and returns the closest point on the plane. The structure is identical, one dimension up.

Two neighboring questions use different tools again. For the straight gap between two points, in 2D, 3D or along a straight diagonal, use the distance calculator or, for the diagonal of a rectangle specifically, the diagonal distance calculator. For three points at once, such as the sides of a triangle from its corners, the distance between 3 points calculator returns all three pairwise distances together.

Common mistakes that change the answer

Dropping the sign of c. In 3x + 4y - 10 = 0, c is -10, not 10. Entering +10 moves the line and changes the numerator from -3 to 17, turning a 0.6000 answer into 3.4000. When a line is written as ax + by = k, rewrite it as ax + by - k = 0 first, so c = -k.

Skipping the denominator. The numerator alone is not a distance. It scales with the coefficients: 6x + 8y - 20 = 0 is the same line as the example, with double the numerator. Only dividing by sqrt(a^2 + b^2) makes the answer a property of the geometry rather than of how the equation happens to be written. The reference treatment in MathWorld's point-line distance entry makes the same point: the normalized form is the distance, the unnormalized value is not.

Forcing a vertical line into slope-intercept form. A line such as x = 3 has no slope and no y intercept equation. It is easy in general form: a = 1, b = 0, c = -3. A horizontal line is the mirror case, a = 0 with b nonzero, and works in every mode.

Measuring to a segment and calling it a line. As noted above, some competitor tools describe their two point input as a line segment while actually computing the infinite line distance. Decide which your problem needs before trusting the number; the two answers differ whenever the foot falls beyond an endpoint.

What competing calculators miss

The point to line tools ranking for this term each cover only part of the job, and one describes its own math incorrectly.

One entry mode each. The bravecalculator tool takes general form only, and the calculatorshub and truegeometry tools take two points only. A user whose line arrives as y = mx + b has to convert by hand before starting, which is exactly where sign errors creep in. This page takes all three forms directly and converts internally.

No foot, no steps. None of the three returns the foot of the perpendicular, and none shows the substitution with your numbers. A bare distance cannot be checked; a distance with its foot can, in two independent ways, as the worked example shows.

A segment claim the math does not support. The calculatorshub page states its formula gives the distance to the line segment defined by two points, but the formula it prints is the infinite line formula, with no endpoint clamping. Used on a segment problem with the foot outside the segment, it silently returns the wrong answer. This page makes the opposite choice and says so plainly: it measures to the infinite line, and flags the segment case as different.

Frequently Asked Questions

d = |a x0 + b y0 + c| / sqrt(a^2 + b^2), for the line ax + by + c = 0 and the point (x0, y0). The numerator is the line equation evaluated at the point, and the denominator is the length of the normal vector (a, b), which turns that value into a true distance.

Any other segment from the point to the line is the hypotenuse of a right triangle whose shorter leg is the perpendicular segment. A hypotenuse is always longer than either leg, so the perpendicular meeting point is the closest point on the line.

No. With a = b = 0, the equation ax + by + c = 0 stops describing a line: it is either impossible or true everywhere. The calculator rejects that input instead of dividing by zero.

Use the Two points tab and enter both points the line passes through. The calculator converts them to general form with a = y2 - y1, b = x1 - x2 and c = x2 y1 - x1 y2, then applies the same distance formula. The two points must be different.

It is the point on the line closest to yours, where the perpendicular from your point meets the line. With the signed value s = (a x0 + b y0 + c) / (a^2 + b^2), the foot is (x0 - a s, y0 - b s). The calculator reports it alongside the distance because projections, reflections and closest point problems need it.

No. This page covers a point and a line in the 2D plane. A point and a plane in 3D use the matching point to plane formula with one more coordinate, and a point to a line in 3D uses a cross product formula instead, because a 3D line has no single normal vector.

Add This Calculator to Your Website

Embed the Distance From Point to Line Calculator on your own site. Pick a size to preview it live, then copy the code.

Powered by Calculator Zilo

References

  1. Weisstein, Eric W., "Point-Line Distance: 2-Dimensional", MathWorld, a Wolfram resource: the normalized distance formula, the two point form, and the projection derivation used for the foot of the perpendicular. MathWorld: Point-Line Distance, 2-Dimensional. Accessed October 2026.
  2. Wikipedia, "Perpendicular distance": the definition of point to line distance as the length to the nearest point on the line, and the perpendicular regression context. Wikipedia: Perpendicular Distance. Accessed October 2026.
  3. Wikipedia, "Hesse normal form": the unit normal form of a line equation, where the constant term is the signed distance from the origin. Wikipedia: Hesse Normal Form. Accessed October 2026.
  4. Wikipedia, "Euclidean distance": the point to point distance used to verify that the gap between the point and its foot equals the reported perpendicular distance. Wikipedia: Euclidean Distance. Accessed October 2026.

Related calculators

Geometry Calculators45 45 90 Triangle Calculator A 45-45-90 triangle is the isosceles right triangle: two equal legs, a right angle, and a hypotenuse that is always the leg times √2.Geometry CalculatorsPerimeter Formula Calculator – Calculate Perimeter of Any Shape InstantlyGive this calculator a shape and its dimensions and it returns the perimeter with the formula written out and your numbers substituted, so you can follow every step.Geometry CalculatorsParallel Or Perpendicular CalculatorAre two lines parallel, perpendicular, or neither?Geometry Calculators30 60 90 Calculator: Solve Any Triangle FastA 30-60-90 triangle locks its sides into the ratio 1: √3: 2, so a single known value fixes the whole triangle.Geometry CalculatorsSin Calculator: Free Trigonometry Tool OnlineA sin calculator should do more than one ratio.Geometry CalculatorsGeometric Formula CalculatorSix shapes account for most geometry homework and most job-site measurement questions: rectangle, circle, triangle, square, sphere and cylinder.

We use cookies to analyze traffic. You can accept or decline cookies below. Learn more

calculatorzilo

CalculatorZilo

Free calculators for everyday life. No signup, no cost, just answers.

Categories

Finance Math Health & Fitness Education Science Real Estate Chemistry Browse all calculators

Popular tools

Mortgage Payment Calculator BMI Walking Calculator Salary Per Minute Calculator Percentage Off Calculator

Company

About Us Contact Us Privacy Policy Terms and Conditions
Disclaimer Cookie Policy DMCA Policy Affiliate Disclosure FAQ Accessibility Statement

© 2026 CalculatorZilo • Free calculators for everyone

  • Home
  • Calculators
    • Browse all calculators
    • Education
    • Real Estate
    • Chemistry
  • Finance
  • Math
  • Health & Fitness
  • Science
  • About
  • Contact
Search