find regression line calculator

Linear Regression Line Calculator

Enter your paired data below to find the best-fit line in the form y = mx + b.

What is a regression line?

A regression line is a straight line that best describes the relationship between two variables. In simple linear regression, we model this relationship as:

y = mx + b

  • m = slope (how much y changes when x increases by 1)
  • b = y-intercept (the value of y when x is 0)

If your data points trend upward from left to right, the slope is positive. If they trend downward, the slope is negative.

How this find regression line calculator works

This calculator uses the least squares method. That means it chooses the line that minimizes the total squared vertical distance between your actual data points and the predicted points on the line.

Formulas used

For n paired values (xi, yi):

  • Slope: m = (nΣxy - ΣxΣy) / (nΣx² - (Σx)²)
  • Intercept: b = (Σy - mΣx) / n
  • Correlation: r = (nΣxy - ΣxΣy) / √[(nΣx² - (Σx)²)(nΣy² - (Σy)²)]
  • Coefficient of determination: R² = r²

You get the equation, slope, intercept, correlation coefficient, and R² in one click.

How to use it (step by step)

  1. Enter your X values in the first box.
  2. Enter your Y values in the second box, in the same order.
  3. Click Calculate Regression Line.
  4. Read your regression equation and fit statistics.
  5. Optionally enter a specific x value to estimate y.

Tip: You can separate values by commas, spaces, or line breaks.

Interpreting the output

Slope (m)

The slope tells you the average change in y for every 1-unit increase in x. For example, if m = 2.5, then y increases by 2.5 on average when x increases by 1.

Intercept (b)

The intercept is the estimated value of y when x = 0. Depending on your context, this may or may not have practical meaning.

Correlation (r)

Correlation ranges from -1 to 1. Values near 1 indicate a strong positive linear relationship, values near -1 indicate a strong negative linear relationship, and values near 0 indicate weak linear association.

R-squared (R²)

R² shows how much of the variation in y is explained by x using your linear model. For instance, R² = 0.84 means 84% of y’s variability is explained by the regression line.

Common mistakes to avoid

  • Entering different numbers of X and Y values.
  • Using non-numeric characters in the data fields.
  • Assuming correlation proves causation.
  • Applying linear regression when the relationship is clearly curved.
  • Using only one or two points and expecting reliable predictions.

When should you use linear regression?

Use this find regression line calculator when you want a quick model for two numerical variables and the relationship appears approximately linear.

  • Study hours vs exam score
  • Ad spend vs sales
  • Temperature vs energy usage
  • Age of machine vs maintenance cost

Final thoughts

A regression line is one of the most practical tools in statistics, data science, business analysis, and research. With this calculator, you can quickly find the line equation, evaluate model fit, and make simple predictions. For serious decision-making, always pair the numbers with subject-matter judgment and diagnostic checks.

🔗 Related Calculators