Linear Regression Calculator

Fit a straight line to x and y data, read the slope, intercept and R², and predict y for any value of x.

Runs in your browser — nothing is uploaded

About the Linear Regression Calculator

Linear regression finds the straight line that comes closest to a set of points by minimising the sum of squared vertical distances. The slope says how much y changes for each unit increase in x, and the intercept is the predicted y when x is zero.

R² measures the share of the variation in y that the line explains, from 0 to 1. Enter one x, y pair per line, at least two pairs with different x values, and the calculator gives the equation and a prediction for the x value you choose.

FAQ

Linear Regression Calculator — frequently asked

What does R² tell me?

R² is the fraction of variation in y explained by x through the line. An R² of 0.9 means 90 percent of the variation is captured by the fit. It does not show whether the relationship is linear or causal.

Is a high R² always good?

Not always. A high R² can come from a few influential points or from a relationship that is curved. Plot the data and check the residuals before relying on the line.

Does correlation imply causation?

No. Two variables can move together because of a third factor, by chance, or because one causes the other. Regression describes the association; a study design is needed to test cause.

Can I predict far outside my data?

Be cautious. The line is most reliable within the range of your x values. Extrapolating far beyond that assumes the pattern continues, which is often false.

Why must the x values differ?

If every x is the same, the slope cannot be estimated, because there is no horizontal spread to explain the vertical spread. The calculator reports this case.

Is my data stored?

No. The data is processed in your browser and nothing is saved.

    Report an issue