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.
How to use
- 1 Enter your data as “x, y” pairs, one per line.
- 2 The least-squares best-fit line is drawn over the scatter plot.
- 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
Find a trend line
Fit a straight line through measurements to model a linear relationship.
-
2
Forecast values
Use the fitted equation to estimate y for a new x.
-
3
Assess correlation
Check r and R² to see how strongly two variables move together.
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
- Least Squares Fitting — Wolfram MathWorld — Wolfram MathWorld
- Simple linear regression — Wikipedia
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.
Related tools
Percentage Calculator
Three-in-one percentage calculator: X% of Y, X as a % of Y, and % increase/decrease. Instant, client-side.
Open toolScientific Calculator
Online scientific calculator — trig, log, powers, roots, factorial, π/e, DEG/RAD, with a proper expression parser. Client-side.
Open toolFraction Calculator
Add, subtract, multiply and divide fractions with automatic simplification, decimal and mixed-number output. Client-side.
Open toolCombinations & Permutations Calculator
Exact nCr, nPr and n! with big-integer precision. Client-side, no signup.
Open toolBuild, share, and grow on Zerethon Social
Free signup. Earn points, collect achievements, and connect with creators worldwide.