Linear Regression Calculator

Fit a straight line to x and y data and get the slope, intercept and R squared.

Quick answer: Linear Regression Calculator: Fit a straight line to x and y data and get the slope, intercept and R squared. Everything runs in your browser, so nothing you enter is uploaded or stored.

How to use Linear Regression Calculator

  1. Enter your values in the fields.
  2. The results update instantly as you type.
  3. Note or copy the numbers you need.

Features

Formula

slope = (n sum xy - sum x sum y) / (n sum x^2 - (sum x)^2); intercept = (sum y - slope sum x) / n.

Worked example

For x = 1 to 5 and y = 2, 4, 5, 4, 5 the line is y = 0.6x + 2.2 with R squared 0.6.

Frequently asked questions

How do I enter data?

Type x values in one box and y values in the other, separated by commas.

What is R squared?

The share of variation in y explained by the line, from 0 to 1.

Is the Linear Regression Calculator free?

Yes. It is free, needs no signup and works on any device.

More free tools