All Tools
Linear Regression Calculator
Enter paired data to find the best-fit line, correlation, and residuals. Drag the prediction point along the line to explore. All calculations run in your browser.
Tip: Press Ctrl+Enter (Cmd+Enter on Mac) to calculate.
Reference Guide
The Least Squares Method
The best-fit line minimizes the sum of squared differences between observed and predicted values.
Slope
Intercept
Correlation Coefficient (r) and R²
Pearson's r Measures the strength and direction of a linear relationship, from −1 to +1.
R² (Coefficient of Determination) The proportion of variance in y explained by x. Calculated as .
Values above 0.7 suggest a strong relationship. Between 0.3 and 0.7 is moderate. Below 0.3 is weak.
Interpreting Slope and Intercept
Slope (m) For each one-unit increase in x, y is predicted to change by m units. A negative slope means y decreases as x increases.
Intercept (b) The predicted value of y when x is zero. Be careful interpreting this if x = 0 is outside your data range, since the model may not hold there.
Extrapolation warning Predictions beyond the range of your data (extrapolation) are less reliable than predictions within the range (interpolation).
Residuals and Model Assumptions
Residual The difference between the observed and predicted value.
Residual plot Plot residuals against predicted values. If the linear model fits well, residuals should scatter randomly around zero with no visible pattern.
Warning signs A curved pattern suggests a nonlinear relationship. A funnel shape suggests unequal variance (heteroscedasticity). Both indicate the linear model may not be appropriate.