QuickToolbox

Linear Regression Calculator

Fit the best straight line through your x and y data and get the slope, intercept, R squared and a prediction for any x.

These tools are for study and quick checking. A result is only as good as the numbers you enter and the simplifying assumptions in the formula. For published, regulated or safety-critical work, check it against a trusted source or an instrument.

How it works

The formula

y = slope x + intercept, with slope = sum((x - mean x)(y - mean y)) / sum((x - mean x)^2)

Frequently asked questions

What does R squared mean?

The share of the variation in y that the line explains. 1 means a perfect fit.

Can I predict outside my data?

You can, but the result is less reliable the farther you go from the data (extrapolation).

Is what I enter sent anywhere?

No. The calculation is done in your browser, so your numbers are not sent to a server or saved.

Related tools