Linear Regression Calculator

Fit a straight line (y = mx + b) to paired X and Y data using least squares.

Calculate

Enter your values below.

Result

Slope (m)
0
Intercept (b)
0

Formula used

The least-squares method finds the line y = mx + b that minimizes the total squared vertical distance to every data point.

Example: X: 1,2,3,4,5 and Y: 2,4,5,4,5 → y ≈ 0.6x + 2.2.

How to use this calculator

  1. Enter X values (comma-separated), Y values (comma-separated).
  2. Press Calculate to see your result instantly.

Frequently asked questions

What does the slope tell you?

How much Y is predicted to change for each one-unit increase in X.

What does the intercept tell you?

The predicted value of Y when X equals zero.

How is the line fitted?

By the least-squares method, which minimizes the sum of squared differences between actual and predicted Y values.

Is this the same as correlation?

Related but different — correlation measures the strength of a linear relationship, while regression fits an actual predictive line.