Skip to content
NWS Kit

Linear Regression Calculator

Line of best fit, slope, intercept and R² with a scatter plot.

Line of best fit
y = 1.99x + 0.05
Slope
1.99
Intercept
0.05
r
0.998652
r²
0.997305
Points
5
Show the working
  1. 1Slope = Σ(x−x̄)(y−ȳ) ÷ Σ(x−x̄)² = 1.99
  2. 2Intercept = ȳ − slope × x̄ = 0.05
  3. 3r² = 0.9973 of the variance is explained by the line
Formula
y = mx + b (least squares)

How it works

Fits the straight line that minimises the squared vertical distance to your points, and reports how well it fits (r²).

Example

The near-linear data above fits y ≈ 1.99x + 0.05 with r² ≈ 0.997.

Runs on this deviceSent to a server: 0 bytes

How it works

  1. Type in your numbers.
  2. The answer updates as you type.
  3. Change any figure to compare. Nothing you enter is sent anywhere.

Line of best fit, slope, intercept and R² with a scatter plot. It is one of the Statistics calculators in NWS Kit. There is no sign-up, and the numbers you enter stay on your device.

Questions

Is the Linear Regression Calculator free to use?

Yes. The Linear Regression Calculator is completely free, with no account, no sign-up and no usage limits.

Does my data leave my device?

No. The Linear Regression Calculator runs entirely in your browser. Nothing you type is uploaded, logged or stored on a server.

Can I use the Linear Regression Calculator on my phone?

Yes. The page works in any modern mobile or desktop browser, and there is nothing to install.

What else is in Statistics?

Mean, deviation, regression, probability and distributions. You can browse the full Statistics category for related calculators.