Regression Line Calculator
Calculate the linear regression line (least squares method) for a set of data points. Get the slope, intercept, and R-squared value.
Was this calculator helpful?
How to use this tool?
This calculator computes the linear regression line (best-fit line) for a set of data points using the least squares method.
- Enter data points in the text area, one pair per line, with X and Y values separated by a comma. For example:
1,22,43,5 - Click "Calculate Regression" to process the data.
- View the results:
- Slope (m) – the rate of change in Y per unit change in X.
- Intercept (b) – the Y value when X = 0.
- R² – the coefficient of determination (0 to 1), indicating how well the line fits the data.
- Equation – the full regression line formula:
y = mx + b.
- Error handling: If all X values are identical, or if input is invalid (non-numeric or missing values), an error message will appear.
Tip: Use at least 2 distinct X values for a meaningful regression. The calculator accepts any number of pairs.
Previous Results
| Result | Inputs | Date |
|---|
Frequently Asked Questions
A regression line is a straight line that best fits a set of data points, used to model the relationship between two variables.
Enter each pair of X and Y values on a new line, separated by a comma. For example: 1,2 then 2,4.
R² (R-squared) indicates how well the regression line fits the data. A value close to 1 means a good fit.