Linear Regression Calculator
Best fit line y = mx + b with slope, intercept and R².
Best for: Use it to model a trend, forecast, or quantify how one variable relates to another.
Input
How it's calculated & sources
Free & no sign-up · runs entirely in your browser. Results are estimates for general information, not professional advice — verify important decisions with a qualified expert. Last reviewed June 2026.
How it works
Slope m = Σ(xᵢ − x̄)(yᵢ − ȳ) / Σ(xᵢ − x̄)²
Intercept b = ȳ − m·x̄. Line: y = m·x + b. R² = 1 − SSres/SStot.
Example
x=1,2,3,4,5 y=2,4,5,4,5 → y = 0.6x + 2.2, R² ≈ 0.6
Frequently asked questions
What does R² mean?+
Proportion of variance in y explained by x. 1 = perfect fit, 0 = no linear relation.
Continue your journey
Where people usually head next.