Linear Regression Calculator
Enter x and y values to get the best-fit line, slope and R squared.
How this calculator works
The calculator fits the least-squares line y = a + bx. The slope b equals the covariance of x and y divided by the variance of x, and the intercept a makes the line pass through the point of means. R squared shows how much of the variation in y the line explains.
Frequently asked questions
What does R squared tell me?
It ranges from 0 to 1. A value near 1 means the line fits the data closely.
How many points do I need?
At least two, but more points give a more reliable line.
Can I predict values outside my data?
You can, but predictions far outside the data range are less reliable.