How to use Linear regression calculator
- 01Paste X and YSame number of values.
- 02Type an X to predictOptional.
- 03Read the equationWith R² and residuals.

The least-squares line.
Least squares picks the line that makes the sum of squared vertical distances (residuals) from the points as small as possible. The slope is b = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)² and the intercept is a = ȳ − b x̄. The standard error of the slope gives a t-test of whether the slope differs from zero.
At a glance
- Price
- Free. No sign-up, no watermark.
- Privacy
- Your text stays in your browser. Nothing is uploaded.
- Works in
- Chrome, Edge, Firefox and Safari, on phones and computers
Questions
Can you show a small worked example?
For X = 1, 2, 3, 4, 5 and Y = 2, 4, 5, 4, 5: x̄ = 3, ȳ = 4, Σ(x − x̄)(y − ȳ) = 6 and Σ(x − x̄)² = 10, so b = 0.6 and a = 4 − 0.6 × 3 = 2.2. The line is ŷ = 2.2 + 0.6x, with R² = 0.6, and it predicts 5.8 at X = 6.
What is a residual?
The actual Y minus the Y the line predicts. A good fit has residuals that are small and scattered without a pattern; a curve in the residuals means a straight line is the wrong model.
Is this the same as Excel’s LINEST or a trendline?
Yes. Ordinary least squares gives the same slope, intercept, R² and standard errors as LINEST, a chart trendline or a TI calculator’s LinReg.
Is what I type sent anywhere?
No. The calculation runs in your browser and nothing you type leaves your device.