Skip to content
M2TOOLKIT

Linear Regression Calculator

Fit a straight line to your data and see how well it explains the relationship.

  • Free
  • No sign-up
  • Nothing is sent or stored

Paste two columns from a spreadsheet, or type pairs separated by a comma or space.

Result

Line of best fit
y = 2.02x − 0.02
Slope (b)
2.02
Intercept (a)
-0.02
Correlation (r)
0.999105
R²
0.998211
99.82% of the variation in y is explained by x
Standard error of estimate
0.178885
Predicted y at x = 7
14.12
Fitted values and residuals
xyPredictedResidual
12.120.1
23.94.02-0.12
36.26.040.16
47.88.06-0.26
510.110.080.02
612.212.10.1

The calculation happens instantly in your browser. The numbers you enter are not sent to our servers or saved.

How to use the Linear Regression Calculator

  1. Paste or type your data, one x, y pair per line.
  2. Read the equation of the line, r and R².
  3. Enter an x value to predict y.

What does this tool do?

Simple linear regression finds the straight line y = bx + a that minimises the squared vertical distances to your points — the least-squares line. The slope b tells you how much y changes for each unit of x.

The correlation r runs from −1 to 1 and measures how tightly the points follow a line. R² is the share of the variation in y explained by x. The residuals table shows how far each point is from the line.

Why use it?

  • Paste two columns straight from a spreadsheet.
  • Correlation, R² and standard error.
  • Residuals for every point.

The formula

b = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)²
a = ȳ − b x̄
r = Sxy ÷ √(Sxx Syy)

Accuracy and limits

  • Correlation doesn't imply causation, and a linear fit can be misleading if the true relationship curves.

Privacy

The calculation happens instantly in your browser. The numbers you enter are not sent to our servers or saved. There's no account to create and nothing to install.

Last reviewed by the M2Toolkit team.

Other tools people use alongside the linear regression calculator.