🔍
📉

Linear Regression Calculator

Enter paired x and y data points to fit a least-squares regression line and predict y for a new x value.

What This Calculator Does

Linear regression fits a straight line, y = a + bx, through a set of paired x,y data points, capturing the best overall linear trend between the two variables using the least-squares method. Leave optional pairs blank to exclude them.

The Formula

The slope is b = [nΣxy − ΣxΣy] / [nΣx² − (Σx)²], and the intercept is a = (Σy − bΣx) / n. Together these define the line that minimizes the sum of squared vertical distances between the line and each data point.

Making Predictions

Once you have the slope and intercept, you can predict a y value for any new x by plugging it into y = a + bx. This calculator does that automatically for the "Predict Y for X" value you enter.

Note: Predictions are most reliable within the range of your original data and for general educational and planning purposes.

Last reviewed August 2026