Linear Regression Calculator

Paste your X and Y values to compute the best-fit regression line.

How to use

  1. Enter your values in the fields above.
  2. Press Calculate to see your result instantly.
  3. Use the Share button to copy a link to your result.

About this calculator

A linear regression calculator fits a straight line y = mx + b to a set of (x, y) data points by minimizing the sum of squared vertical distances between the line and the points — the method of least squares. The slope is m = (nΣxy − ΣxΣy) / (nΣx² − (Σx)²) and the intercept is b = (Σy − mΣx) / n; the calculator also reports the Pearson correlation coefficient r and the coefficient of determination R², which tells you what fraction of the variance in y is explained by x.

This is the same math behind the trendline feature in Excel or Google Sheets, and it underpins everything from stock-price trend analysis to lab-instrument calibration curves. Students, scientists, engineers, and analysts use it to quantify a relationship between two variables, forecast a y value for a new x, and judge — via R² — how reliable that forecast actually is.

Was this helpful?

Comments (0)

  • Be the first to comment.

Popular calculators

All Calculators