Loading the page...
Preparing tools and content for you. This usually takes a second.
Preparing tools and content for you. This usually takes a second.
Fetching calculator categories and tools for this section.
Free line of best fit calculator & linear regression calculator. Calculate slope, y-intercept, R-squared, and correlation coefficient from data points. Our complete regression analysis tool uses the least squares method to find the optimal trend line for your data.
Last updated: February 2, 2026
Need a custom statistics calculator for your research platform? Get a Quote
Enter data points as "x, y" pairs, one per line (e.g., 1, 2)
Line of Best Fit Equation:
y = 0.8x + 1.2
Slope (m):
0.8
Y-Intercept (b):
1.2
R² (Coefficient of Determination):
0.92
Excellent fit
Correlation (r):
0.96
Positive correlation
Sample Predictions:
x = 1.00 → y ≈ 2.00
x = 3.00 → y ≈ 3.60
x = 5.00 → y ≈ 5.20
Interpretation:
The line of best fit shows a positive linear relationship with R² = 0.92, meaning approximately 92.0% of the variance in y is explained by x.
Linear Regression Tips:
Method
Least Squares
Minimizes sum of squared residuals for optimal fit
Output
y = mx + b
Get slope and y-intercept for prediction equation
Range
0 to 1
Indicates percentage of variance explained by the model
Range
-1 to +1
Shows strength and direction of linear relationship
Analysis
Visual Trend
See relationship between variables with regression line
Components
m and b values
Calculate rate of change and y-axis intersection point
For data points (1,2), (2,3), (3,4), (4,4), (5,5):
Equation
y = 0.8x + 1.2
Slope
0.8
R²
0.92
r
0.96
Our line of best fit calculator uses the least squares regression method to find the optimal linear trend line. The calculator computes the slope and y-intercept that minimize the sum of squared vertical distances between data points and the line, producing the most accurate linear model for your data.
Slope (m): m = (n·Σxy - Σx·Σy) / (n·Σx² - (Σx)²)
Y-Intercept (b): b = (Σy - m·Σx) / n
R-squared: R² = 1 - (SSresidual / SStotal)
Correlation (r): r = ±√R² (sign matches slope)
Equation: y = mx + b
These formulas implement the method of least squares, which Carl Friedrich Gauss developed. The method finds the unique line that minimizes the sum of squared residuals, making it the optimal linear approximation for the data.
Data points with linear regression line showing residuals
Linear regression is a fundamental statistical method for modeling relationships between variables. The line of best fit represents the average relationship and can be used for prediction. The R-squared value indicates how well the line explains the variance in the data, with values closer to 1 indicating better fit. The correlation coefficient shows both the strength and direction of the linear relationship.
Need help with other statistical calculations? Check out our variance calculator and percentage calculator.
Get Custom Calculator for Your PlatformResults:
Equation: y = 6.3x + 60
R²: 0.95 (excellent fit - 95% variance explained)
Interpretation: Each additional study hour increases test score by ~6.3 points on average
All points on line, r = 1
R² = 1.00 (100% explained)
Negative slope, r = -0.85
Strong inverse relationship
Share it with others who need help with linear regression
Suggested hashtags: #LinearRegression #Statistics #DataAnalysis #Mathematics #Calculator