Linear Regression Calculator

Fit a least-squares line through your data points: slope, intercept, correlation r, r² and predictions — with the scatter plot and fit line drawn live.

Example values are shown — change any of them and the answer updates live.

Format: x, y — one pair per line.

Prediction

At the mean of x

4

x̄ = 3

Extrapolate x + 5

7

x = 8

Extrapolating beyond your data gets less trustworthy the further you go.
Extrapolating beyond your data gets less trustworthy the further you go.

Best-fit line

Step 1 · m (slope)
m = Sxy ÷ Sxx
n=5
0.6
Step 2 · b (intercept)
b = ȳ − m·x̄
x̄=3
2.2
Step 3 · r (correlation)
r = Sxy ÷ √(Sxx·Syy)
0.7746

Exact arithmetic — computed instantly in your browser.