Skip to main content
Z Math

Linear Regression — Best-Fit Line, r, R²

Least-squares best-fit line with r and R² and a live scatter plot. Client-side; your data stays private.

Free No signup Client-side Privacy friendly Updated

How to use

  1. 1 Enter your data as “x, y” pairs, one per line.
  2. 2 The least-squares best-fit line is drawn over the scatter plot.
  3. 3 Read the slope, intercept, correlation r and R².

Why use this tool

  • Least-squares linear regression with a live scatter plot.
  • Gives the line equation plus correlation (r) and goodness of fit (R²).
  • Runs entirely in your browser — your data never leaves your device.

Frequently asked questions

What is linear regression?

Fitting the straight line y = mx + b that minimises the sum of squared vertical distances to your data points (the least-squares line).

What does the correlation r mean?

r ranges from −1 to +1 and measures how strongly the points follow a straight line. Values near ±1 are strong; near 0 is weak.

What is R²?

The coefficient of determination — the fraction of the variation in y explained by the line. R² = r² for simple linear regression.

How many points do I need?

At least two. More points give a more reliable fit; the x values must not all be identical.

What is Linear Regression Calculator?

A linear regression calculator fits the least-squares straight line to a set of (x, y) data points and reports its slope, intercept, correlation coefficient r and coefficient of determination R².

Features

Least-squares fit

Computes slope and intercept that minimize squared residuals, with the equation of the line.

r and R²

Reports the Pearson correlation and coefficient of determination to gauge fit quality.

Free & private

Runs on your device — your data is never uploaded.

Example

Input

(1,2) (2,4) (3,6)

Output

y = 2x + 0 · r = 1 · R² = 1

Common use cases

  1. 1

    Find a trend line

    Fit a straight line through measurements to model a linear relationship.

  2. 2

    Forecast values

    Use the fitted equation to estimate y for a new x.

  3. 3

    Assess correlation

    Check r and R² to see how strongly two variables move together.

Summary

Zerethon's linear regression calculator fits a least-squares line y = a + bx to your (x, y) data points in your browser, reporting the slope, intercept, correlation coefficient r, and R², plus a scatter plot with the fitted line. Everything runs client-side — nothing is uploaded.

Category
Math
Pricing
Free
Privacy
Browser-based
Signup
Not required

References

Privacy

Your data never leaves your browser unless explicitly stated. Linear Regression Calculator runs entirely client-side — no server upload, no logging, no tracking of your input.

Build, share, and grow on Zerethon Social

Free signup. Earn points, collect achievements, and connect with creators worldwide.

Try Zerethon free