Linear Regression Calculator
Paste a list of x values and a list of y values, or fill a paired table, and the calculator fits the least-squares line. It returns the slope, the intercept, the equation, the correlation r and r squared, and a prediction at any x you choose, with a table of the working in exact fractions.
How to use the linear regression calculator
Result
The working
Enter your numbers above to see the answer and every step.
-
Checked on
Method: standard mathematical definitions and textbook formulas, shown in full in the working.
Worked example
With x values 1, 2, 3, 4, 5 and y values 2, 4, 5, 4, 5, the slope is 3/5, which is 0.6, and the intercept is 11/5, or 2.2. The correlation r is about 0.774597 and r squared is 0.6.
Slope, intercept and correlation
The steps of the worked example appear here.
Method and sources
Let Sxx be the sum of squared distances of x from its mean and Sxy the sum of the products of the x and y distances. The slope is Sxy over Sxx, and the intercept is the mean of y minus the slope times the mean of x. The correlation r is Sxy over the square root of Sxx times Syy. If all x values are equal the slope is undefined, and if all y values are equal r is undefined; the page says so.
What it does not cover
- Simple least squares with one predictor only. There is no outlier detection or significance test, so a high r does not show cause.
Rules and calculation checked on 11 Oct 2026.
Questions people ask
How to do linear regression on a calculator?
Paste the x and y lists on this page, and the line of best fit appears with its working. In the example above the slope is 3/5 and the intercept is 11/5. Handheld models use a regression menu, so check the manual for those keys.
How to find linear regression on a calculator?
Compute the means of x and y, the sum of squared x distances and the sum of cross products, then divide to get the slope and use the means for the intercept. The tool shows each of these lines for your data.
How to use linear regression on a calculator?
Enter paired x and y values, read the equation of the line, then type an x to predict y. The page also gives r and r squared, so you can judge how closely the points follow the line.
Related calculators
Paste a list of numbers to get the mean, a table of distances from the mean, and both sample and population standard deviation, with the divisor named.
Variance calculatorPaste a list of numbers to get sample and population variance, with the mean, a table of squared distances from the mean and the divisor stated for each.
Mean, median and modePaste a list of numbers to get the mean, median, every mode and the range, with the sorted list shown and the middle value marked to follow each step.
Probability distribution calculatorWork out binomial, Poisson and normal probabilities with mean, variance and z-score, and see each term of a binomial or Poisson sum listed.
Results follow the published rules shown above and are for guidance. For formal use, check them against your university's, board's or school's own document.