Linear Regression Calculator
Least-squares regression line y = mx + b and R-squared from two paired lists, with a prediction at any X value. Free, instant, no sign-up.
Slope m = Σ((x−x̄)(y−ŷ)) ÷ Σ(x−x̄)²; intercept b = ŷ − m×x̄. R² is the share of Y variation explained by the line. Predictions beyond the data range are less reliable.
How to use the linear regression calculator
- Enter the X values and the matching Y values.
- Optionally enter an X value to predict Y at.
- Press “Calculate Regression” to see the line, R² and the prediction.
Linear regression calculation example
For x = 1, 2, 3, 4, 5 and y = 2, 4, 5, 4, 5 the least-squares line is y = 0.6x + 2.2. At x = 6 it predicts y = 5.8.
Tips for using the linear regression calculator
- Predict only within or near the range of your data; extrapolating far out is unreliable.
- Look at r² to see how much of the variation the line explains (0.60 here).
- Plot residuals: a pattern means a straight line is the wrong model.
Linear regression calculator: common questions
- What does the slope mean?
- How much Y changes for a one-unit rise in X. A slope of 0.6 means Y rises by about 0.6 per unit of X.
- What is R-squared?
- The share of the variation in Y explained by the line, from 0 to 1. Near 1 means the line fits the points closely.
- Is my data stored?
- No. The calculation runs in your browser.
- What does the slope mean?
- The change in y for each 1-unit increase in x — here y rises by 0.6 for every extra 1 in x.