Linear regression calculator
Fits the straight line closest to your points and uses it to predict, such as estimating sales from ad spend.
Loading the tool…
Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.
How to use it
- Enter x values, y values (same order as x) and x to predict (optional).
- The result appears straight away and updates as you edit.
- Copy the result, or copy a link that keeps the same values to share it.
How it is calculated
Slope b = Σ(x - x̄)(y - ȳ) ÷ Σ(x - x̄)². Intercept a = ȳ - b × x̄. Prediction ŷ = a + b × x.
Example
Inputs: X to predict (optional) = 6. Result: Regression equation: y = 0.6x + 2.2; Slope (b): 0.6; Intercept (a): 2.2.
1, 2, 3, 4, 5
y = 0.6x + 2.2
Limits and caveats
- Predicting outside the range of your X data can mislead, since the relationship may change.
- Assumes a straight-line relationship; plot the data first if you suspect a curve.
Questions about this tool
What does the slope mean?
It is how much Y changes when X rises by one unit. A slope of 0.6 adds 0.6 to Y per unit of X.
What does r² tell me?
The share of the variation in Y that the line explains. 0.6 means the line explains 60% of it.
Does it match Excel SLOPE and INTERCEPT?
Yes, both use ordinary least squares.
