Least-Squares Method · Instant R²

Linear Regression Calculator

Calculate slope, intercept, best-fit line, R² value, and predict future Y values from any set of X-Y data points instantly.

X Y Action

Slope

--

Intercept

--

R² Value

--

Equation

--

Predicted Y

--

Is There Actually a Relationship Between My Two Variables?

That's the real question a regression line answers, and it's more precise than eyeballing a scatter plot. The calculator fits a straight line through your data using the least-squares method (minimizing the total squared distance between the line and every point), then reports two numbers that matter most: the slope, which tells you how strongly X moves Y, and R², which tells you how much you should actually trust that relationship.

Enter your X-Y pairs, calculate, and you get the full picture, slope, intercept, R², the equation itself, and a live prediction tool so you can plug in any new X and see what the line projects for Y.

What Counts as a "Good" R²? It Depends on Your Field

This is the part most regression tutorials skip, and it causes real confusion: there is no universal cutoff for a "good" R². What counts as strong evidence of a relationship in one field would be considered a failed model in another, because some kinds of data are inherently noisier than others.

0.95 – 1.0
Expected in physics and engineering. Controlled experiments with precise instruments, if your R² isn't near this range here, something in the setup is probably off.
0.7 – 0.9
Strong in business and economics. Sales trends, pricing models, and market data have real-world noise, this range is considered a solid, usable fit.
0.3 – 0.5
Can be genuinely meaningful in social and behavioral science. Human behavior has enormous unexplained variance, so a "weak-looking" R² here can still represent a real, publishable effect.
Below 0.3
Usually too weak to act on, in almost any field, though even this depends heavily on sample size and what decision the model is informing.

The takeaway: don't judge your R² against some fixed "good" number. Judge it against what similar analyses in your specific domain typically produce. A 0.4 that would be disappointing in engineering can be a legitimately interesting finding in psychology.

Your Line Predicts, But Does X Actually Cause Y?

A high R² proves your two variables move together, it does not prove one causes the other. The classic textbook trap is exactly the kind of pair this calculator handles well: ice cream sales and temperature move together with a high R², but so would ice cream sales and drowning incidents, because both are driven by the same underlying cause, summer weather, not by each other. Before you present a regression result as "X drives Y," ask whether a third factor could be moving both variables at once. The math can't tell you that, only domain knowledge can.

If you're working with time-based data specifically, our era calculator can help contextualize date ranges when you're checking whether a trend lines up with a particular historical period rather than a true causal driver.

Understanding Each Output

Output FieldWhat it ShowsUseful For
SlopeThe rate of change: how much Y changes for each unit increase in XUnderstanding strength and direction of relationship, forecasting sensitivity
InterceptThe Y value when X is zero (where the regression line crosses the Y-axis)Finding baseline values, model interpretation
R² ValueCoefficient of determination (0 to 1): what percentage of Y's variation is explained by XAssessing model quality, judged against your field's typical range
Regression EquationThe mathematical formula of the best-fit line: Y = slope×X + interceptMaking predictions, documentation, communicating results
Predicted YThe Y value estimated by the regression line for any given X value you enterForecasting, scenario analysis, what-if planning

Benefits of Using the Linear Regression Calculator

  • Instant calculations: compute slope, intercept, and R² in seconds without manual math
  • Interactive data entry: add or remove points dynamically and recalculate on the fly
  • Prediction power: forecast Y values for any X using the regression equation
  • R² assessment: understand how well your data fits a linear model, and how to judge it against your field
  • Perfect for education: ideal for statistics courses, machine learning basics, and research
  • Free and instant: no signup, runs entirely in your browser, unlimited calculations

How to Use Results Effectively

  • For data analysis: evaluate R² against your field's typical range, not a fixed universal number
  • For forecasting: use the regression equation to predict future values, but stay within your original data's range
  • For understanding relationships: the slope tells you strength and direction; always ask if a third variable could explain both
  • For homework and exams: verify your manual calculations instantly and build confidence
  • For research papers: copy the equation, slope, and R² value for academic documentation

Example: if you enter monthly ice cream sales (Y) against average temperature (X), the calculator might return slope = 150, intercept = 50, and R² = 0.92. For every degree increase in temperature, ice cream sales increase by 150 units, and temperature explains 92% of sales variation. When temperature reaches 25°C, the model predicts sales at 150×25 + 50 = 3,800 units. Strong fit, but still just correlation, not proof that temperature alone drives every sale.

Frequently Asked Questions

What is linear regression?
Linear regression is a statistical method that finds the best-fit straight line through a set of data points. The line is described by the equation Y = slope×X + intercept, where slope is the rate of change and intercept is the Y-axis starting point.
What does slope mean and how do I interpret it?
Slope is the rate of change: it tells you how much Y increases (or decreases) for each unit increase in X. A slope of 2 means Y increases by 2 for every 1-unit increase in X. A negative slope means Y decreases as X increases.
What does intercept mean?
Intercept is the Y value when X is zero. It's where the regression line crosses the Y-axis, often the baseline before X begins to have an effect.
What R² value counts as "good"?
There's no universal threshold, it depends on your field. Physics and engineering typically expect 0.95+, business and economics consider 0.7-0.9 strong, and social or behavioral science can consider 0.3-0.5 genuinely meaningful given how much natural variance exists in human behavior. Judge your R² against what's typical in your specific domain, not a fixed number.
Does a high R² prove X causes Y?
No. A high R² only shows the two variables move together closely, not that one causes the other. Two variables can be strongly correlated because a third factor drives both, the classic example is ice cream sales and drowning rates, both driven by summer weather, not by each other.
How many data points do I need for accurate results?
You need at least 2 data points to calculate a linear regression. However, for meaningful and reliable results, at least 10-20 points are recommended.
Can I use this calculator for predictions?
Yes. Once you calculate the regression, enter any X value in the prediction field and click Predict. Predictions are most reliable within the range of your original data, extrapolating far outside it is risky.
Is this calculator free?
Yes. It is completely free, runs entirely in your browser, requires no signup, and stores nothing, see our Privacy Policy.