Statistics

Linear Regression Calculator

Pair two numeric lists to see the slope, intercept, R², and a quick ŷ prediction for whatever X you care about.

regressiontrendlineslopeprediction
Linear Regression Calculator

Feed paired X and Y values to get slope, intercept, R², and a fast prediction for any X.

Pairs processed
5
Slope (m)
1.83
Intercept (b)
-0.39
Correlation (r)
0.99
0.979
Mean of X
3
Mean of Y
5.1
Prediction (x = 6)
10.59
Regression line
y = 1.83x - 0.39

Regression Fit

Least-squares line

m = Σ((x − x̄)(y − ȳ)) / Σ(x − x̄)²
b = ȳ − m x̄
ŷ = b + mx

The calculator centers your data, computes the best-fit slope m and intercept b, and reports the coefficient of determination R² for that simple linear model.

How to use

  1. Enter X values separated by commas, spaces, or new lines.
  2. Enter the matching Y values in the same order and length.
  3. Optionally set an X value to forecast so the tool returns ŷ for that input.

Example

Input: X = 1, 2, 3, 4, 5; Y = 1.8, 3.2, 4.4, 7.1, 9.0; Predict x = 6

Output: Slope ≈ 1.82, Intercept ≈ 0.04, R² ≈ 0.98, Prediction ≈ 10.0

Student-friendly breakdown

This walkthrough emphasizes the most searched ideas for Linear Regression Calculator: linear regression calculator, line of best fit calculator, least squares calculator, simple linear regression online. Start with the formula above, then follow the guided steps to double-check your work. For quick revision, highlight the givens, plug into the equation, and finish by verifying your units.

Need more support? Use the links below to open the long-form guide, browse additional examples, or hop into adjacent calculators within the same topic — each one is a quick way to double-check your work or handle a related question without starting from scratch.

Deep dive & study plan

Linear Regression Calculator: Fits a least-squares line, returns slope/intercept, and predicts any Y value. It's built around regression, trendline, slope, prediction, so you can go from a raw question to a checked answer without switching tools.

The math behind it: The calculator centers your data, computes the best-fit slope m and intercept b, and reports the coefficient of determination R² for that simple linear model. The core relationship is m = Σ((x − x̄)(y − ȳ)) / Σ(x − x̄)² b = ȳ − m x̄ ŷ = b + mx, shown above the calculator so you can see exactly how your inputs turn into the result.

To use it well: (1) Enter X values separated by commas, spaces, or new lines. (2) Enter the matching Y values in the same order and length. (3) Optionally set an X value to forecast so the tool returns ŷ for that input. Keep your units consistent as you go, and re-run a case you already know the answer to — it's the fastest way to catch a typo before it throws off a result you're relying on.

Worked example: entering X = 1, 2, 3, 4, 5; Y = 1.8, 3.2, 4.4, 7.1, 9.0; Predict x = 6 returns Slope ≈ 1.82, Intercept ≈ 0.04, R² ≈ 0.98, Prediction ≈ 10.0. Try swapping in your own numbers next, especially a case you're unsure about, before you use this for something that matters.

Quick retention checklist

  • Speak the formula aloud (or annotate it) so the relationships stick.
  • Write each step in your own words and compare with the numbered list above.
  • Swap in new numbers for the Example to make sure the calculator (and your logic) handles edge cases.
  • Check at least one related calculator below — it's the fastest way to confirm your numbers still line up from a different angle.

FAQ & notes

What happens if every X value is identical?

Vertical lines cannot be expressed as y = mx + b, so the slope is undefined and the calculator will ask for more varied X values.

Can I enter blanks or text?

Non-numeric tokens are ignored, so you can safely paste spreadsheet columns that contain labels or missing values as long as both lists stay the same length.

What formula does the Linear Regression Calculator use?

The calculator centers your data, computes the best-fit slope m and intercept b, and reports the coefficient of determination R² for that simple linear model.

How do I use the Linear Regression Calculator?

Enter X values separated by commas, spaces, or new lines. Enter the matching Y values in the same order and length. Optionally set an X value to forecast so the tool returns ŷ for that input.