Linear Regression Calculator

Find the line of best fit (y = mx + b) for your data. Enter one x,y pair per line.

Slope (m)
Intercept (b)
Correlation (r)
R² (fit quality)
Data points used

Linear regression calculator

This calculator finds the line of best fit for a set of data points using the least-squares method. Paste or type your x,y pairs (one per line) and it returns the regression equation y = mx + b, along with the slope, intercept, correlation coefficient (r), and the coefficient of determination (R²) that tells you how well the line fits your data.

Understanding the results

The slope (m) shows how much y changes for each one-unit increase in x, and the intercept (b) is the value of y when x is zero. The correlation r ranges from −1 to +1: values near ±1 mean a strong linear relationship, while values near 0 mean little or no linear link. is the proportion of variation in y explained by x — an R² of 0.95 means the line explains 95% of the variation.

What it is used for

Linear regression is used across science, business, and statistics to find trends and make predictions — from forecasting sales to analysing experiments. For statistical summaries of a single dataset, see our scientific data analysis tool.

Frequently asked questions

How many data points do I need?

At least two, but more points give a more reliable line. The calculator tells you how many valid points it used.

What does a negative slope mean?

It means y decreases as x increases — a downward trend.