Linear Regression Calculator
Paste x, y data to find the best-fit line y = mx + b, its R², and predicted values for any x.
How to use it
- Enter paired data One x, y pair per line.
- Read the line See the equation, slope, intercept and R².
- Predict values Enter an x to estimate y from the fitted line.
Examples
| y = 2x + 1 | slope 2, R² 1 |
|---|---|
| predict x=10 | y = 21 |
About this tool
Linear regression finds the straight line that best fits a set of points, in the least-squares sense. The result is an equation, y = mx + b, you can use to describe a trend or predict new values.
This calculator reports the slope, intercept and R² (how well the line fits), and lets you predict y for any x. It is ideal for spotting and quantifying simple trends. Everything runs in your browser.
Frequently asked questions
What is least-squares regression?
It finds the straight line that minimizes the total squared vertical distance to your data points — the standard "line of best fit".
What does R² tell me?
R² is the proportion of the variation in y explained by the line, from 0 (no fit) to 1 (perfect fit).
Related tools
Updated June 12, 2026