About Linear Regression Calculator
A line of best fit summarises how one measured quantity changes with another, but the numbers behind it matter: the slope, the intercept, the correlation and the residuals each describe a different part of the relationship. Reporting only r, for example, hides whether the line actually passes near the points.
This calculator fits a least-squares line to data you paste, shows the slope and intercept with the working, reports r and r², and lists residuals for every pair. A scatter plot marks the fitted line and an optional prediction, which is flagged as extrapolation when it falls outside the observed range.
What this tool does
Least-squares fit with working
Slope and intercept are computed from Sxx, Sxy and the means, and the step section shows that arithmetic with your numbers.
Correlation and r²
Read r for the direction and strength of the linear relationship and r² for the share of variation in y explained by the line.
Residual summary and table
See SSE, the mean and largest residual, and a per-pair table of observed, fitted and residual values.
Predictions with a warning
Enter an x value to get a predicted y; the tool flags extrapolation beyond the data range instead of implying the line is reliable there.
Accessible scatter plot
An SVG plot with a text description and a data table shows the points, the fitted line and the prediction without relying on colour alone.
Flexible pasted data
Pairs can be comma, tab or space separated with one pair per line, and an optional header row is ignored.
How to use Linear Regression Calculator
- 01
Paste the paired data
Put one x,y pair per line, separated by a comma, tab or space; a header row such as x,y is optional.
- 02
Check the fit statistics
The slope, intercept, r and r² appear above the plot, with the means and correlation details beside them.
- 03
Review the residuals
The residual table shows how far each observed y sits from the fitted value; patterns in it suggest a straight line may not be the right model.
- 04
Optionally predict a value
Type an x value in the prediction field; the predicted y appears and is marked on the plot.
- 05
Read the extrapolation warning
If the x value is outside the observed range, the tool warns that the prediction is an extrapolation rather than a data-backed value.
How this tool works
- Works with
- X,Y PAIRS → FIT + R
- Processing
- Client-side, in your browser. Nothing is uploaded.
- Requirements
- Chrome, Edge, Firefox or Safari · JavaScript enabled
Limitations worth knowing
- Only a single-variable straight line is fitted; curved relationships need a different model.
- Least squares is sensitive to outliers, and the tool does not detect or exclude them.
- A maximum of 2,000 pairs is accepted, and predictions outside the observed x range are extrapolations.
Privacy and file handling
The pairs you paste are parsed and fitted with plain JavaScript inside your browser tab. Nothing is uploaded, logged or stored, and no request is made to a server while you work. Closing the page clears the data.
Read the full privacy policy