Fit a best-fit line to a set of x,y data points.
Last updated: June 2026 | By Patchworkr Team
Enter at least two points.
The least squares line minimizes squared vertical residuals. The slope and intercept come from the standard closed-form sums over the data points.
For points 1,2; 2,3; 3,5; 4,4; 5,6 the best-fit line is approximately y = 1.1x + 0.5.
Can I enter invalid lines?
No. Each non-empty line must be a valid x,y pair.
How many points do I need?
At least two points are required.
What if all x-values are equal?
Regression is undefined because the denominator becomes zero.
Does blank input count as zero?
No. Blank input is treated as missing, not zero.
Related Tools
Calculate gradient.
Calculate line intersection.
Calculate line equation.
Calculate plane intersection.
Calculate parallel lines.
Calculate perpendicular lines.