Linear Regression Calculator
Linear Regression Calculator
Enter two paired lists of numbers (matching each x value with its corresponding y value, in order). This calculates the simple linear regression line that best fits your data — the slope, the intercept, the coefficient of determination (R²), and the full equation.
The "least squares" method behind the slope specifically minimizes the sum of squared vertical distances between each data point and the fitted line, which is why it produces a uniquely determined best-fit line rather than an arbitrary one drawn by eye. The slope itself is directly interpretable: for every one-unit increase in x, y changes by exactly the slope value — a slope of 2.5 means y rises by 2.5 units for every one-unit rise in x — while R² separately tells you how well the line actually explains the scatter in the data, with a value close to 1 indicating a tight fit and a value close to 0 indicating the line barely explains the pattern at all.
- Formula: the slope b minimizes the sum of squared vertical distances between each data point and the line ("least squares"), and the intercept a is chosen so the line passes through the data's average point.
- Slope tells you the rate of change: for every one-unit increase in x, y changes by the slope value — a slope of 2.5 means y increases by 2.5 for each unit increase in x.
- R² measures fit quality: R² close to 1 means the line explains most of the variation in y; R² close to 0 means x barely predicts y at all through a straight-line relationship.
Can I use this equation to predict y for a new x value?
Yes, within the range of x values you provided — plug your new x into y = a + bx using the calculated slope and intercept, but be cautious extrapolating far outside your original data range.
Why does the intercept sometimes not make practical sense?
The intercept is the predicted y when x = 0, which is sometimes outside the realistic range of your data (e.g. predicting a house price when square footage is zero) — it's mathematically necessary for the equation but isn't always practically meaningful.
Linear Regression Calculator


Enter two paired lists of numbers (matching each x value with its corresponding y value, in order). This calculates the simple linear regression line that best fits your data — the slope, the intercept, the coefficient of determination (R²), and the full equation.
The "least squares" method behind the slope specifically minimizes the sum of squared vertical distances between each data point and the fitted line, which is why it produces a uniquely determined best-fit line rather than an arbitrary one drawn by eye. The slope itself is directly interpretable: for every one-unit increase in x, y changes by exactly the slope value — a slope of 2.5 means y rises by 2.5 units for every one-unit rise in x — while R² separately tells you how well the line actually explains the scatter in the data, with a value close to 1 indicating a tight fit and a value close to 0 indicating the line barely explains the pattern at all.

- Formula: the slope b minimizes the sum of squared vertical distances between each data point and the line ("least squares"), and the intercept a is chosen so the line passes through the data's average point.
- Slope tells you the rate of change: for every one-unit increase in x, y changes by the slope value — a slope of 2.5 means y increases by 2.5 for each unit increase in x.
- R² measures fit quality: R² close to 1 means the line explains most of the variation in y; R² close to 0 means x barely predicts y at all through a straight-line relationship.
Can I use this equation to predict y for a new x value?
Yes, within the range of x values you provided — plug your new x into y = a + bx using the calculated slope and intercept, but be cautious extrapolating far outside your original data range.
Why does the intercept sometimes not make practical sense?
The intercept is the predicted y when x = 0, which is sometimes outside the realistic range of your data (e.g. predicting a house price when square footage is zero) — it's mathematically necessary for the equation but isn't always practically meaningful.
