Linear Regression Calculator

Fit a straight line to paired X and Y measurements by minimizing squared vertical residuals.

Result
—

How it works

Fit a straight line to paired X and Y measurements by minimizing squared vertical residuals.

Worked example

X values: 1, 2, 3 · Y values: 3, 5, 7. The result is y = 2x + 1.

How to read the result

The fitted equation gives the slope and intercept, and R² is reported when Y varies. X must contain at least two different values.

Least squares fit from NIST

Related calculators