Straight Line Calculator
Build a line from two points or a point and slope, inspect its intercepts, and find perpendicular or parallel-line distances.
Use consistent units. Enter numbers without thousands separators. Invalid input clears all results.
Inputs and results
Choose the matching mode, then read each field label and note. Results use the same length, time, currency or quantity units as the inputs unless a label says otherwise. A negative change means a decrease.
Formula
For points (x1,y1),(x2,y2), take a=y1-y2, b=x2-x1, c=x1y2-x2y1. For point-slope: y-y1=m(x-x1). For ax+by+c=0, slope=-a/b when b≠0 and point distance=|ax0+by0+c|/√(a²+b²). Parallel-line distance uses unit-normalized coefficients, aligned to the same normal direction.
Worked example
The line 3x+4y-10=0 has slope -3/4, x-intercept 10/3, y-intercept 2.5 and distance 10/5=2 from the origin. Its distance from 6x+8y=0 is also 2.
Limits and edge cases
Cartesian coordinates and consistent length units are assumed. Inputs have magnitude at most 1e12. Duplicate points and degenerate a=b=0 lines are rejected. Use two-points or coefficient mode for vertical lines. Near-parallel normals within 1e-12 are treated as parallel in the parallel-distance mode. Decimal calculations use floating-point arithmetic; displayed values are rounded to 12 significant digits. This is an educational tool, not a guarantee about investments or physical systems.
FAQ
Is a vertical line invalid?
No. Its slope and y-intercept may be undefined, but its equation and point distance remain valid.
Can I multiply all line coefficients by the same number?
Yes. Nonzero scaling represents the same line; distance is normalized accordingly.
Formula reference
Background mathematics. Explanation and examples on this page are independently written.