Linear Regression Calculator
Fit a least-squares line to your data and get slope and R-squared.
Draw the best-fit line
Linear regression finds the straight line that best summarizes a scatter of points, which is the starting point for trend analysis and prediction. This tool fits it by least squares.
Paste your x,y points and it returns the slope, intercept, the full equation, and the R-squared value that tells you how well the line fits. A high R-squared means a strong linear relationship.
Rigorous and private
It computes the least-squares fit in your browser, so your data never leaves your device.
Frequently Asked Questions
What does it fit?
The best-fit straight line through your points by ordinary least squares, minimizing the squared vertical distances.
How do I enter data?
One point per line as x,y — for example 1,2 then 2,4 — with at least two points.
What is R-squared?
The share of variance the line explains, from 0 to 1. Values near 1 mean the points hug the line closely.
Browse the full set of free, private, in-browser tools.