This tool fits a straight line to your paired X and Y data using simple linear regression (ordinary least squares). It returns the slope, intercept, correlation, and R-squared, along with the equation of the best fit line so you can make predictions and understand how strongly X and Y move together.
You provide two equal-length lists of numbers (X values and Y values). The calculator then computes the line Y = slope × X + intercept that best summarizes the relationship between them, in the least squares sense.
Enter your X and Y values as two lists of the same length. Each position in the X list must match the same position in the Y list (they form pairs).
3.5, -2, 10).You can copy a column directly from a spreadsheet and paste it into the X or Y box. Then paste the matching column into the other box, making sure you do not insert or delete any rows in between.
To see how the calculator works, try this small example of study time (hours) and test scores (points out of 100):
X (hours studied):
1 2 3 4 5 6
Y (test score):
52 57 63 68 74 79
If you paste these values into the calculator, you will get a positive slope. That slope tells you how many test score points tend to increase, on average, for each additional hour of study. You will also see an R-squared close to 1, meaning the straight line explains most of the variation in scores for this simple example.
The calculator uses the standard least squares formulas for simple linear regression with one predictor X and one outcome Y.
Let there be n data pairs . First compute the sample means of X and Y:
Here, the summation symbol means “add up over all data points.” The slope and intercept of the best fit line are:
The resulting regression line is:
For any chosen X value, is the predicted Y on the line.
The calculator often also computes the Pearson correlation coefficient between X and Y, and then R-squared as .
R-squared (the coefficient of determination) is then:
R-squared measures the proportion of the variability in Y that can be explained by a linear relationship with X in this model.
The slope tells you how much Y tends to change when X increases by one unit.
Always interpret the slope in the original units. For example, if X is “hours” and Y is “dollars,” a slope of 15 means each extra hour is associated with about $15 more.
The intercept is the predicted value of Y when X is zero. Sometimes this has a direct meaning (e.g., predicted starting weight when age = 0 days in a growth study). In other cases, X = 0 is outside the realistic range (e.g., 0 years of education in a dataset of adults), so the intercept is just a mathematical anchor for the line and should not be over-interpreted.
R-squared ranges from 0 to 1:
A higher R-squared does not prove a causal relationship, and a lower R-squared does not necessarily mean the model is useless; it depends on the context and how much noise is typical in your field.
Using the earlier study-time dataset:
X (hours): 1, 2, 3, 4, 5, 6
Y (score): 52, 57, 63, 68, 74, 79
For this dataset, the resulting equation is approximately:
Predicted score = 48.9 + 4.9 × hours studied
This means each extra hour of study is associated with roughly a 5-point increase in the test score, and the positive intercept shows the baseline level at very low study time. The calculator performs all these steps automatically for any dataset you enter.
| Output | What it represents | How to interpret it |
|---|---|---|
| Slope (b1) | Average change in Y for a one-unit increase in X | Sign (positive/negative) shows direction; magnitude shows strength of change per unit of X |
| Intercept (b0) | Predicted value of Y when X = 0 | Meaningful only if X = 0 is realistic; otherwise mainly anchors the line |
| Correlation (r) | Strength and direction of linear association | Ranges from -1 (perfect negative) to +1 (perfect positive); 0 means no linear relationship |
| R-squared (R2) | Proportion of variance in Y explained by the linear model | Close to 1: strong linear fit; close to 0: weak linear fit |
The calculator implements standard simple linear regression, which relies on several assumptions. These are not enforced by the tool, so it is your responsibility to judge whether they are reasonable for your data.
Because the tool is designed for quick, exploratory analysis, you should treat its output as one piece of evidence and combine it with subject-matter knowledge and more detailed diagnostics when decisions are important.
Click to guide your trend line—catch drifting points before noise pulls them away.
Tip: After you calculate, the game tunes targets to your latest slope and intercept.