Skip to content
LoveToCalc

Regression calculator

Type two lists of numbers and see the best-fitting line or curve, its equation and how well it fits.

One y for each x, in the same order. Separate the numbers with commas, spaces or semicolons; the lists are paired in order. The first example is the data the page opens on.

Fit
Try:

Fitted curve

y = 0.6x + 2.2

Constant term
2.2
Coefficient of x
0.6
R²
0.6
Correlation r
0.7746

How to use it

What the fits do

All the polynomial fits are least squares: they choose the coefficients that make the sum of squared vertical distances from the points as small as possible, by solving the normal equations (XᵀX)c = Xᵀy. The exponential fit y = a·e^(bx) takes the logarithm of y, fits a straight line to (x, ln y), and turns the intercept back into a. That minimises the error in ln y, not in y, which is what spreadsheets and graphing calculators do too; both R² values are shown.

R² is the share of the variation in y that the curve explains, 1 − SS_res / SS_tot. Adding a degree never lowers R², so a quartic through six points looks better than it is. With as many coefficients as points the curve passes through everything and R² = 1 says nothing.

Example. The points (1, 2), (2, 4), (3, 5), (4, 4), (5, 5) give the line y = 0.6x + 2.2 with R² = 0.6.

Last reviewed October 20, 2026 ·How pages are reviewed

The formula behind this

All math calculators

Put this calculator on your site

Copy the code into your page where the calculator should appear. It loads from lovetocalc.com, so it stays current on its own — all we ask is that the credit line comes with it.