Linear Regression Calculator

Paste matching X and Y values to get the least-squares regression line, the correlation coefficient and a scatter plot.

Regression lineŷ = 1.5714 + 1.2619x
Correlation r0.9672
r²0.9354
Slope1.2619
Intercept1.5714
123456784681012

Step by step

  1. Means: x̄ = 4.5, ȳ = 7.25
  2. Sxx = Σ(x − x̄)² = 42, Syy = 71.5, Sxy = Σ(x − x̄)(y − ȳ) = 53
  3. Slope b = Sxy ÷ Sxx = 1.2619
  4. Intercept a = ȳ − b·x̄ = 1.5714
  5. r = Sxy ÷ √(Sxx·Syy) = 0.9672

Formulas

b = Sxy ÷ Sxx   a = ȳ − b x̄
r = Sxy ÷ √(Sxx Syy)

Reading r

r runs from −1 to 1: near ±1 is a strong straight-line relationship, near 0 is none. r² is the share of the variation in y explained by the line. Correlation is not causation, and a line can be misleading for curved data — always look at the scatter plot.

Frequently asked questions

How do you find the line of best fit?

Least squares: slope b = Sxy ÷ Sxx and intercept a = ȳ − b·x̄.

What is a good r value?

|r| above about 0.7 is usually called strong, 0.3–0.7 moderate, below 0.3 weak.

Last reviewed November 2026. Results are rounded to 4 decimal places; all math runs in your browser.