Skip to content

Linear Regression Calculator

Fit a least-squares line to paired x and y data and see slope, intercept, correlation, and R².

Linear Regression Calculator interactive tool

Enter data points

Separate values with commas, spaces, or new lines.

Must have the same count as x values.

Best-fit line

Least squares regression line:

y = 0.9000 · x + 1.3000

Slope (m)

0.9000

Intercept (b)

1.3000

Correlation (r)

0.9000

0.8100

R ranges from −1 (perfect negative linear correlation) to +1 (perfect positive). R² shows how much of the variation in y is explained by the linear model.

What Is Linear Regression?

A linear regression calculator fits a straight line y = mx + b through a set of (x, y) data points using the least squares method. It reports the slope, intercept, correlation coefficient r, and R² value so you can judge how well the line explains the data.

When to Use Linear Regression

Linear regression is used in science experiments, economics, and data analysis whenever you suspect a roughly linear relationship between two variables. Students can paste values from a spreadsheet into this regression tool, get the best‑fit line, and then interpret the slope and R² in the context of their project or lab report.

How To Use the Linear Regression Calculator

  1. Paste or type your x values into the first box, separated by commas, spaces, or new lines.
  2. Paste or type the corresponding y values into the second box, making sure there are the same number of values as in x.
  3. The linear regression calculator will compute the best-fit line y = mx + b using least squares.
  4. Review the slope, intercept, correlation coefficient r, and R² to understand how well the line fits your data.
  5. Use the Example button to load a simple dataset, or Reset to start with an empty form.

Slope, intercept, and R² from data points

This linear regression calculator fits y = mx + b to paired x and y values using least squares. Use it to calculate slope, intercept, correlation, and R² for a small dataset or a statistics exercise.

Need the formula or convention behind this result? Read the calculator methods and assumptions.

Linear Regression Calculator FAQs

Related Tools