The correlation coefficient tells you whether two measured variables move together, and how strongly. This calculator computes the Pearson product-moment correlation coefficient (r) from two paired lists of numbers — the same quantity reported by Excel's CORREL, Google Sheets, and numpy's corrcoef. You also get r-squared, the covariance, and a 95% confidence interval so you can judge not just the point estimate but how reliable it is.
Enter each pair of values in the numbered X and Y boxes (up to eight pairs at a time) and every result updates instantly. Positive r means the two variables rise together; negative r means one falls as the other rises; r near zero means there is no straight-line relationship.
How to Use
- Set Number of Pairs, then enter each X value — your first variable. For example, the hours studied for each student.
- Enter each Y value — your second variable, paired with X in exactly the same order. If the first X belongs to student one, the first Y must also belong to student one.
- Keep the two lists the same length. If you have six rows of data, enter values in boxes X1–X6 and Y1–Y6; leave X7/Y7 and X8/Y8 at 0.
- Read the result card: Pearson r is the headline number from -1 to +1, r² tells you the share of variation explained, and the 95% confidence interval shows how reliable that estimate is for your sample size.
A few practical notes. Decimals and negative numbers are fine (temperature below zero, below-average sales). You need at least three pairs; with only two points r is always +1 or -1 and tells you nothing. Correlation only measures linear trends — a curved relationship can hide inside r = 0, which the examples below demonstrate.
The Pearson Correlation Formula
Pearson r standardizes the covariance by the spread of each variable:
r = Σ(xᵢ − x̄)(yᵢ − ȳ) / √( Σ(xᵢ − x̄)² · Σ(yᵢ − ȳ)² )
Where x̄ and ȳ are the means of the two lists. The numerator is the covariance; dividing by both standard deviations forces r onto a fixed scale from -1 to +1, which is why correlation can be compared across completely different units — dollars, percentages, kilograms, test scores.
The range and what it means:
- r = +1 — perfect positive linear relationship (as one rises, the other rises exactly).
- r = -1 — perfect negative linear relationship (as one rises, the other falls exactly).
- r = 0 — no linear relationship at all.
- 0.7 ≤ |r| < 1 — strong correlation.
- 0.3 ≤ |r| < 0.7 — moderate correlation.
- 0 < |r| < 0.3 — weak correlation.
r² (the coefficient of determination) is even easier to explain: if r = 0.80, then r² = 0.64, meaning about 64% of the variation in Y is linearly explained by X. The remaining 36% comes from other factors and noise.
The 95% confidence interval is calculated with the Fisher z transformation, which is reliable even for small samples. A wide interval (for example, -0.57 to +0.92) warns you that a single point estimate can mislead until you collect more data.
Examples
Example 1 — A perfect positive relationship. X = 1, 2, 3, 4, 5 and Y = 2, 4, 6, 8, 10. Each Y is exactly double X, so the points lie on a straight line and r = 1.000, r² = 1.000. This is the textbook ceiling; real-world data almost never reaches it.
Example 2 — Study hours vs test score. X = 1, 2, 3, 4, 5, 6, 7, 8 hours studied; Y = 65, 70, 72, 78, 80, 85, 88, 92 (percent scores). The calculator gives r ≈ 0.997 and r² ≈ 0.994 — a strong positive correlation, meaning extra study time explains about 99% of the variation in the percentage score. The 95% confidence interval is roughly 0.98 to 1.00.
Example 3 — Ad spend vs revenue. X = $200, $350, $500, $650, $800, $950 monthly ad spend; Y = $420, $610, $780, $940, $1,150, $1,320 revenue. Here r ≈ 0.999, r² ≈ 0.999, and the covariance is about $78,500. The near-perfect r suggests spend and revenue moved almost in lockstep — but remember correlation is not proof that the ads caused the revenue.
Example 4 — The trap of r = 0. X = -3, -2, -1, 0, 1, 2, 3 and Y = 9, 4, 1, 0, 1, 4, 9 (Y is simply X squared). Because the points form a symmetric U-shape, r = 0.000 — yet the relationship is perfectly deterministic. This is why a zero correlation does not always mean "no relationship"; it means no linear relationship. Always plot your data.
FAQ
What does a correlation of 0.8 mean?
An r of 0.80 is a strong positive linear correlation. Squaring it gives r² = 0.64, so about 64% of the variation in one variable is explained by the other. The remaining 36% is due to other factors and random noise. Directionally, as one variable goes up, the other tends to go up too.
What is the difference between positive and negative correlation?
A positive r means the two variables move in the same direction (more study hours, higher scores). A negative r means they move in opposite directions (higher altitude, lower temperature). The sign tells you direction; the size (ignoring the sign) tells you strength. r = -0.85 is just as strong as r = +0.85.
Can correlation ever be higher than 1 or lower than -1?
No. By construction Pearson r is bounded between -1 and +1. If you ever see a value outside that range, your data has a bug — usually a mismatched row order or one variable with zero spread (all identical numbers), which makes a denominator zero.
Does a high correlation prove causation?
No. This is the most common mistake. Two variables can be strongly correlated because a third factor drives both (ice cream sales and drowning both rise in summer), or because the correlation is purely coincidental in a small sample. Correlation identifies a pattern; experiments, controls, and domain knowledge establish cause.
How many data points do I need?
You need at least three pairs for the formula to run meaningfully, but small samples are unreliable. With N = 5, a single outlier can flip r from +0.9 to -0.5. The 95% confidence interval widens sharply when N is small — collect more observations before making decisions, and treat any interval that crosses zero as "no evidence of a real effect."
What is r-squared and how is it different from r?
r is the correlation on a -1 to +1 scale. r² is r multiplied by itself, expressed as a 0% to 100% figure: the fraction of variation in Y explained by X in a linear model. r = 0.7 gives r² = 0.49 (49% explained), while r = 0.5 gives only r² = 0.25 — strength drops off faster than it looks.
Why is my r exactly zero even though the data looks related?
Pearson r only detects straight-line relationships. If your data forms a U-shape, a curve, or any symmetric non-linear pattern, r can come out near zero even though the two variables are perfectly linked. Plot the points before concluding there is no relationship.
Related Calculators
- Regression Line Calculator — fit the OLS line y = mx + b through the same paired data.
- Covariance Calculator — compute the raw covariance before standardizing it into r.
- Standard Deviation Calculator — measure the spread of each variable on its own.
- Correlation Coefficient Calculator — alternate Pearson r tool with rank-based options.
Disclaimer
This correlation calculator is provided for informational purposes only and does not constitute statistical, academic, financial, or medical advice. Results are computed with the standard Pearson product-moment formula and the Fisher z 95% confidence interval from the exact values you enter; they may differ slightly from other tools due to rounding, sample-versus-population conventions, or missing-data handling. Always verify critical decisions with a qualified statistician and inspect a scatter plot before interpreting the result.