Correlation Coefficient Calculator
Pearson's correlation coefficient, r, measures how closely two variables follow a straight line: -1 is a perfect negative link, 0 no linear link and +1 a perfect positive link. Enter matching X and Y lists and the calculator returns r, R² and a strength label.
Last updated by Ultra Calculator
Correlation Coefficient
How to calculate it
r = Σ[(x − x̄)(y − ȳ)] ÷ √[ Σ(x − x̄)² × Σ(y − ȳ)² ]
- r
- Pearson's correlation coefficient, from -1 to +1
- x, y
- the paired values: the first x goes with the first y
- x̄, ȳ
- the means of the X values and of the Y values
- Σ
- add up the result for every pair
R² = r × r. For a straight-line fit with an intercept, it is the share of the variation in Y that the line accounts for.
In Excel or Google Sheets: =CORREL(A2:A11,B2:B11)
Worked example
Perfect positive correlation
Heights from 160 to 180 cm paired with weights from 55 to 75 kg, both rising in equal steps, give r = 1 and R² = 1: every point lies on one straight line. Real height and weight data are rarely this tidy.
| X Values | 160, 165, 170, 175, 180 |
|---|---|
| Y Values | 55, 60, 65, 70, 75 |
| Correlation Coefficient (r) | 1 |
|---|---|
| R² (Coefficient of Determination) | 1 |
| Strength | Nearly Perfect |
| Direction | Positive |
| Number of Pairs | 5 |
How to use this calculator
- Enter the first variable in X Values, separated by commas, spaces or semicolons.
- Enter the second variable in Y Values in the same order, so each Y sits in the same position as its X.
- Read the Correlation Coefficient (r): the sign gives the direction and the size gives the strength.
- Read R² for the share of variation a fitted straight line accounts for.
- If the lists have different lengths, fewer than 3 pairs or no variation, a message says what to change.
Frequently asked questions
How do you calculate the correlation coefficient?
Find the mean of X and of Y. For each pair, multiply the X deviation by the Y deviation and add these products up. Divide by the square root of (sum of squared X deviations × sum of squared Y deviations). The result is r.
What counts as a strong correlation?
Conventions vary by field. This calculator labels |r| below 0.1 negligible, 0.1 up to 0.3 weak, 0.3 up to 0.5 moderate, 0.5 up to 0.7 strong, 0.7 up to 0.9 very strong and 0.9 or more nearly perfect. Other textbooks use different cut-offs, so name the scale you used when you report a label.
What is the difference between r and R²?
r gives the direction and strength of the linear link. R² is r squared: for a straight-line fit with an intercept, the share of the variation in Y that the line accounts for. An r of 0.7 gives R² = 0.49, so just under half the variation.
Does the calculator test whether r is significant?
No, it gives r and R² only. To test r against zero, use t = r × √(n − 2) ÷ √(1 − r²) with n − 2 degrees of freedom. With 5 pairs, |r| has to reach about 0.88 to be significant at the 5% level (two-tailed).
Does correlation prove causation?
No. Two variables can move together because a third factor drives both, because the cause runs the other way, or by chance. Ice cream sales and sunburn cases rise together because hot weather drives both.
When should I use Spearman's correlation instead?
Use Spearman's rank correlation when the relationship is consistently upward or downward but curved, when the data are ranks, or when outliers distort Pearson's r. This calculator gives Pearson's r only.
Learn more
Direction and strength
A positive r means Y tends to rise as X rises, and a negative r means Y tends to fall. The closer |r| is to 1, the more tightly the points hug a straight line. r has no units, so it does not change if you convert centimetres to inches.
Correlation only sees straight lines
Pearson's r measures linear association. Points that follow a perfect U-shape can give r close to 0. Always look at a scatter plot as well as the number.
Outliers carry a lot of weight
One point far from the rest can create a strong correlation or hide one. Check any extreme pair before relying on the result.
- Checking whether study hours and exam marks rise together in a class data set
- Seeing how closely two stock or fund returns move together
- Testing whether a cheap measurement tracks an expensive reference method
- Exploring survey data for pairs of answers that move together
- Getting r for a coursework or dissertation write-up
Lists out of order
The calculator pairs values by position. Sorting one list on its own breaks the pairs and gives a meaningless r.
Lists of different lengths
Every X needs a Y. If the lists differ in length, the calculator says how many values each has rather than guessing the pairs.
Reading a low r as no relationship
r near 0 only rules out a straight-line link. Curved relationships can be strong and still give a small r.
Treating correlation as cause
A strong r shows that two things move together, not that one causes the other. Look for a third factor or a controlled comparison.
- If your data sit in a spreadsheet, keep both columns in the same row order and check that Number of Pairs matches what you expect.
- Report r together with the number of pairs, for example r = 0.62 (n = 40).
- Use the descriptive statistics calculator on each list to spot outliers, and a scatter plot to see the paired pattern.
Methodology and sources
Each list is split at commas, semicolons or spaces. Both lists must have the same number of values, with at least 3 pairs. The calculator finds the two means, adds up the products of the paired deviations, and divides by the square root of the product of the two sums of squares (the same calculation as Excel's CORREL). If every value in a list is the same, r is undefined and the calculator says so. r and R² are rounded to 4 decimal places. Direction is Positive above 0.05, Negative below -0.05, and No Relationship in between. It does not compute a p-value or confidence interval for r.