Linear Regression Calculator
Find the line of best fit and R² from your data points.
Format: x,y — one pair per line. Blank lines and invalid rows are ignored.
Regression Equation
y = 2.034286x + (-0.053333)
R² (coefficient of determination)
0.9979
Strong fit
Correlation (r)
0.998947
n (data points)
6
Summary Statistics
| Slope (m) | Intercept (b) | R² | n | Mean X | Mean Y |
|---|---|---|---|---|---|
| 2.034286 | -0.053333 | 0.9979 | 6 | 3.5000 | 7.0667 |
Predict Y for a given X
Predicted Y = 14.186667
Scatter Plot with Regression Line
Data Table
| x | y | predicted | residual |
|---|---|---|---|
| 1.0000 | 2.1000 | 1.9810 | 0.1190 |
| 2.0000 | 3.9000 | 4.0152 | -0.1152 |
| 3.0000 | 6.2000 | 6.0495 | 0.1505 |
| 4.0000 | 7.8000 | 8.0838 | -0.2838 |
| 5.0000 | 10.1000 | 10.1181 | -0.0181 |
| 6.0000 | 12.3000 | 12.1524 | 0.1476 |
About Linear Regression
Linear regression finds the straight line that best fits a set of data points by minimizing the sum of squared residuals (ordinary least-squares). The formula produces slope m and intercept b so you can express any trend as y = mx + band predict new values. R² (coefficient of determination) measures fit quality: >0.9 is a strong relationship, 0.7–0.9 moderate, and below 0.7 weak. The correlation coefficient r adds direction — positive for upward trends, negative for downward. All calculations run locally in your browser; no data is sent to any server.
Private & free — this tool runs entirely in your browser.
Related Calculators tools
Percentage Calculator
Solve percentage, increase, and change calculations.
Age Calculator
Calculate exact age in years, months, and days.
Unix Timestamp Converter
Convert Unix epoch timestamps to and from human dates.
Tip Calculator
Calculate tip and split the bill between people.
Aspect Ratio Calculator
Solve width or height for a target aspect ratio.
Temperature Converter
Convert between Celsius, Fahrenheit, and Kelvin.
Data Storage Converter
Convert between bytes, KB, MB, GB, TB, and more.
Discount Calculator
Calculate sale price and savings from a discount.