Paste paired x,y data to fit the least-squares line of best fit: slope, intercept, correlation, the fitted equation, predictions for any x — and a scatter plot with your points and the line drawn through them.
The line is chosen to minimize the sum of the squared vertical gaps (residuals) between the points and the line. Squaring punishes big misses heavily, which is why outliers can drag the line.
The slope is how much y changes, on average, when x rises by 1. The intercept is the model's y when x = 0 — meaningful only if x = 0 is inside or near your data's range.
That is extrapolation, and it is risky: relationships often bend beyond the observed range. The calculator will compute it, but the further from your x-range, the less the line deserves trust.
They share the same sums: r is the standardized slope. Regression adds the actual line (in y-units per x-unit) and predictions, which correlation alone cannot give.
Slope b = Sxy ÷ Sxx where Sxy = Σ(x−x̄)(y−ȳ) and Sxx = Σ(x−x̄)². Intercept a = ȳ − b·x̄ — which guarantees the line always passes through the center of mass of the data, (x̄, ȳ). Prediction: ŷ = a + b·x. Also reported: r, r², and the residual standard error.
Inputs: x = [1,2,3,4,5], y = [2,4,5,4,5].
Steps: x̄ = 3, ȳ = 4, Sxy = 6 (from the correlation working), Sxx = 10. Slope = 6 ÷ 10 = 0.6. Intercept = 4 − 0.6 × 3 = 2.2. Prediction at x = 6: 2.2 + 0.6 × 6 = 5.8.
Result: Line y = 2.2 + 0.6x, r = 0.775, r² = 0.600.
Add this calculator to your own website or blog — it is completely free, needs no sign-up, and always shows the latest version. Copy the code below and paste it into your page where you want the calculator to appear. Keeping the small “Powered by Loona Automation” credit line under the embed helps keep this tool free — but you are free to style or remove it; the tool works either way.