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
- Enter your values in the boxes. Where a box has a unit beside it, check the unit before you read the answer.
- The answer updates as you type, so there is no button to press.
- Use Copy results to keep the answer. Check the formula and its limits below if the result will go into a report or an experiment.
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
Exponential Regression Calculator
Fit y = a e^(bx) to data with positive y values, and get the growth rate, doubling time or half-life and a prediction.
Correlation Calculator
Find the Pearson correlation coefficient between two lists of numbers, with R squared, the p-value and a description of the strength.
Scientific Graph Plotter
Plot a function of x or a set of data points with an optional best-fit line, and see the graph right away with axis labels.