Enter your data
You can paste numbers separated by commas, spaces, or new lines. If you prefer, paste pairs like x,y on each line in the X box.
Paste your x and y data and instantly get a linear regression trendline: slope, intercept, correlation (r), R², and predictions. Designed for fast screenshots, homework checks, business experiments, and “is this relationship linear?” vibes.
You can paste numbers separated by commas, spaces, or new lines. If you prefer, paste pairs like x,y on each line in the X box.
Linear regression is the simplest way to summarize a relationship between two numerical variables: an input x (what you control or observe) and an output y (what changes). The idea is to draw a straight line that “best fits” your data points.
The line is written as: ŷ = a + b x. Here, ŷ (y-hat) means “predicted y.” The two key parameters are:
“Best fit” is defined using least squares. For each data point (xᵢ, yᵢ), the line predicts ŷᵢ = a + b xᵢ. The vertical error is eᵢ = yᵢ − ŷᵢ. Least squares chooses a and b to minimize the sum of squared errors: SSE = Σ (yᵢ − ŷᵢ)². Squaring does two things: it makes all errors positive and it punishes big errors more. That’s why one outlier can dominate the fit.
In simple linear regression, the math collapses to two clean formulas using means and variance:
x̄ is the average of all x values, and ȳ is the average of all y values. The numerator in b is essentially the covariance between x and y: it measures whether x and y move together. The denominator is the variance of x: it measures how spread out x is. If all x values are the same (no spread), you can’t fit a line (division by zero), because there’s no way to see how y changes with x.
People love regression because it gives a single, sharable “relationship strength” number. That number is usually R² (pronounced “R-squared”). In simple linear regression with an intercept, R² is the square of Pearson’s correlation r.
Correlation is: r = Σ(xᵢ − x̄)(yᵢ − ȳ) / √(Σ(xᵢ − x̄)² · Σ(yᵢ − ȳ)²). It ranges from -1 to +1: positive means y tends to increase when x increases, negative means y tends to decrease. R² is r², so it ranges from 0 to 1.
Another way to remember it: R² is “how much of y’s wiggle the line explains.” If y is noisy relative to the trend, R² drops.
R² tells you the strength of the relationship, but it doesn’t tell you the size of errors in y-units. That’s where RMSE comes in: RMSE = √(SSE / n) (or √(SSE/(n−2)) in some textbooks). This tool uses √(SSE/n) as a simple, intuitive “average-ish” error. If your y is measured in dollars, RMSE is in dollars. If your y is in degrees, RMSE is in degrees. That makes RMSE great for decision-making: “If I predict y using this line, I’m typically off by ~RMSE.”
Regression is a summary of association, not proof of cause. Ice cream sales and sunburns both rise in summer; regression will show a strong relationship, but ice cream does not cause sunburn. This is why context matters. Use regression as a flashlight, not a verdict.
Here are practical mini datasets. Paste them as lists (X box and Y box), or paste them as pairs in the X box (leave Y empty). Then compare your output to the expected story.
X: 1, 2, 3, 4, 5
Y: 2, 4, 6, 8, 10
X: 10 20 30 40 50
Y: 15 19 35 33 52
(Pairs in X box)
1, 10
2, 9
3, 7
4, 6
5, 5
X: 1,2,3,4,5,6
Y: 2,4,6,8,10,100
Want a quick viral post idea? Run regression on two “relatable” things (sleep vs mood, coffee vs productivity), screenshot the equation + R², and caption it: “My life in one line.”
This tool does three things: (1) it cleans your input, (2) it computes the regression with the standard least-squares formulas, and (3) it formats everything for readability and easy sharing.
We accept commas, spaces, tabs, and line breaks. The calculator tries to be forgiving because real-world copy/paste is messy. It also ignores empty tokens. If you use the “pairs” format, each line is split by comma (or tab), and we read x and y together. If you use two lists, we match by position: the first x goes with the first y, and so on.
Once we have x and y arrays, we compute x̄ and ȳ, then compute slope b and intercept a. With those, we can predict ŷ for each x and calculate errors. That yields SSE and RMSE. We also compute correlation r and R².
Your result card shows the equation and key stats. The fit-quality bar uses R² as the fill value, so you can “feel” the strength at a glance. The share buttons generate a short summary containing equation + R² + prediction (if you asked for one).
Linear regression is not magic. It’s a straight line. If your relationship is curved (like exponential growth, diminishing returns, or U-shapes), a straight line can mislead. Signs you should be cautious:
Still, for quick insight and communication, linear regression is the fastest “data story” tool. It’s the reason trendlines exist in spreadsheets.
This calculator performs simple linear regression with an intercept: ŷ = a + bx. It’s the standard “trendline” most people use in Excel/Google Sheets.
No. High R² means a linear model explains a lot of variation in y, but causation requires domain knowledge, experiment design, and confounder checks.
Your pattern might be non-linear (curved), your data might be noisy, or you might have outliers. Try plotting your points or checking if one value is far from the rest.
r is correlation (direction + strength), ranging from -1 to +1. R² is r squared, ranging from 0 to 1, and represents explained variance in y. r tells you if the slope is positive or negative; R² is always non-negative.
Technically two points define a line, but that’s fragile. For anything meaningful, use more points. With tiny datasets, one outlier can dominate and “fake” a trend.
The intercept is the predicted y at x = 0. If x = 0 is outside your data range (common), the intercept can feel unintuitive. The slope is often the more interpretable parameter.
For linear trendlines, yes: it uses the same least-squares idea. Minor differences can occur due to rounding, settings, or whether the intercept is forced to zero (this tool does not force it).
MaximCalculator provides simple, user-friendly tools. Always treat results as educational guidance and double-check any important numbers elsewhere.