Linear Regression Calculator

Fit a least squares line and predict from it.

Statistics Calculators Free, no sign-up Runs in your browser

Linear Regression Calculator tool

Optional. Uses the fitted line, which is extrapolation outside your data.

The two lists must be the same length.

—
Line of best fit
—
Slope
—
Intercept
—
r squared
—
Predicted Y
Point by point
XYFitted YResidual
StatisticValue
A fitted line describes the range of data it was fitted to. Using it far outside that range is extrapolation, and the fact that the arithmetic still works does not make the answer meaningful.

About the Linear Regression Calculator

Linear Regression Calculator fits a least squares line to paired data and reports the slope, the intercept and how well the line fits. Least squares means the line that minimises the sum of the squared vertical distances from the points, which is the standard definition of a line of best fit.

The slope is the interesting coefficient: it is the change in Y associated with a one-unit change in X. The intercept is where the line crosses the Y axis, which is meaningful only if X equal to zero is a real possibility for your data -- for a regression of weight on height, it is not.

Residuals are listed point by point because they are where a bad fit shows up. A good fit has residuals scattered randomly around zero; residuals that curve, or fan out as X grows, mean a straight line is the wrong model even when r squared looks respectable. The calculator also flags a prediction made outside the range of the data, which is extrapolation and should be treated with suspicion.

The page shows its working, not just its answer. Where there is a formula it is printed with your own numbers substituted in, so you can check the result rather than take it on trust -- which is the difference between a calculator you can use for something that matters and one you cannot.

Everything runs inside your browser. What you type is never uploaded, never logged and never stored, and the calculator keeps working if your connection drops after the page has loaded.

Looking for something this does not cover? FreeToolsZone.org is more free browser-based tools, organised by job, and it is worth a look if linear regression calculator is only part of what you are working on.

How to use the Linear Regression Calculator

  1. Enter predict y when x is, x values and y valuesDecimals are fine, and thousands separators are accepted and ignored.
  2. Read the line of best fit, slope and interceptThe figures update as you type. The Calculate button is there if you would rather press something, but nothing waits for it.
  3. Copy or check the resultCopy the summary with the copy button, or open the table to check it row by row. The download button saves it as a file.

Features

  • Shows line of best fit, slope, intercept, r squared and predicted y together, so you are not running it twice
  • Full point by point you can open and check
  • Updates as you type, with no button to press and no page reload
  • Copy the result in one click
  • Download the detail as a .csv for a spreadsheet
  • Free, no sign-up, and it runs entirely in your browser

Who uses this tool

The linear regression calculator is used by writers, developers, students, marketers and anyone else who needs the job done once without installing software. Common cases include:

  • Fitting a trend line to experimental data
  • Finding the slope and intercept for a report
  • Predicting a value from a fitted relationship
  • Checking residuals for a pattern a straight line misses

Frequently asked questions

What does r squared tell me?

The share of the variation in Y that the line accounts for. 0.6 means sixty per cent explained and forty per cent not.

Can I predict outside my data range?

The arithmetic will, but the answer is extrapolation and the calculator says so. Relationships that hold over one range often do not hold outside it.

What if the residuals show a pattern?

Then a straight line is the wrong model. A curve, a transformation of the variables or a different model entirely is needed, whatever r squared says.

If the linear regression calculator is not quite what you need, these other free tools solve closely related problems, and there are 13 more in statistics calculators.

Slope Calculator

Slope between two points, with angle and line equation.

Geometry Calculators Use tool

Variance Calculator

Sample and population variance with the full working.

Statistics Calculators Use tool

Checked and rebuilt on 2026-10-14. The method this calculator uses is described in the section above, and corrections go through the contact page.