Correlation Calculator

Calculate the Pearson correlation coefficient (r) from paired X and Y data, with its strength, direction, r², a scatter plot and the full calculation.

8 values

8 values

Each X value pairs with the Y value in the same position, so both lists need the same number of values. At least 2 pairs are required, but r from only a handful of points is unreliable.

Example loaded: Study hours vs exam score (hypothetical data).

Pearson correlation coefficientr = 0.950Your data shows a very strong positive linear relationship between X and Y. As X increases, Y tends to increase as well.
Direction
Positive
Strength
Very strong
Rule of thumb, see guide below
r² (coefficient of determination)
0.902
90.2% of the variation in Y is linearly associated with X in this sample
Observations
n = 8

With only 8 pairs, one changed value can move r a lot; treat the strength as a rough indication.

Correlation describes association, not causation.

Scatter plot

2468101260708090XY

r = 0.950, n = 8

Dashed line: least-squares line ŷ = 51.0869 + 2.8601x. Points rising from left to right give a positive r.

Hover over or focus a point to see its exact values.

How the correlation was calculated

r = [nΣxy − (Σx)(Σy)] / √([nΣx² − (Σx)²][nΣy² − (Σy)²])

r = Pearson correlation coefficient, n = number of pairs, x and y = the paired values, Σ = sum over all pairs.

Calculation table
#XYX²Y²XY
125843364116
236293844186
3561253721305
4670364900420
5874645476592
6971815041639
710821006724820
8128814477441056
Σ55566463408144134
  1. Step 1: Add up the columns

    For the n = 8 pairs, total the X values, Y values, their squares and the products X × Y (see the table).

    ΣX = 55, ΣY = 566

    ΣX² = 463, ΣY² = 40814, ΣXY = 4134

  2. Step 2: Numerator: nΣXY − (ΣX)(ΣY)

    8 × 4134 − 55 × 566

    = 1942

  3. Step 3: Denominator: √([nΣX² − (ΣX)²][nΣY² − (ΣY)²])

    nΣX² − (ΣX)² = 8 × 463 − 55² = 679

    nΣY² − (ΣY)² = 8 × 40814 − 566² = 6156

    √(679 × 6156) = 2044.486244

  4. Step 4: Divide

    r = 1942 / 2044.486244

    r ≈ 0.949872

    r² ≈ 0.902257

Explore how the pattern changes r

02468100246810XY

Pearson r

0.977

Very strong positive

Points rise from left to right.

Drag any point, or focus it with Tab and use the arrow keys. Try pulling one point far away from the others to see how much a single outlier can move r.

Interpreting r (illustrative guide)
rGeneral interpretation
+1Perfect positive linear correlation
+0.8Strong positive
+0.5Moderate positive
0No linear correlation
−0.5Moderate negative
−0.8Strong negative
−1Perfect negative linear correlation

Strength bands on |r| used above: under 0.20 very weak, 0.20–0.39 weak, 0.40–0.59 moderate, 0.60–0.79 strong, 0.80 and over very strong. These are a common rule of thumb, not a universal standard; what counts as strong depends on the field.

Pearson vs Spearman
PearsonSpearman
Measures linear correlationMeasures rank (monotonic) association
Uses the actual valuesUses the ranks of the values
Sensitive to outliersOften more robust to outliers
For straight-line relationshipsFor consistently rising or falling relationships, even curved ones

To predict Y from X with the fitted line, use the Linear Regression Calculator. Summarize each variable with the Average Calculator and the Standard Deviation Calculator; need to standardize a value before comparing it? Use the Z-Score Calculator. Planning a study? The Sample Size Calculator estimates how many observations you need.

A correlation calculator measures how closely two variables follow a straight-line pattern. Enter paired data, such as hours studied and exam scores for the same students, and the calculator returns the Pearson correlation coefficient r, from −1 (perfect negative) through 0 (no linear correlation) to +1 (perfect positive).

Alongside r you get the direction and a rule-of-thumb strength, r², the number of pairs, a plain-language interpretation, a scatter plot with the least-squares line, a check for single points that strongly affect r, and a full table of X, Y, X², Y² and XY with the formula worked through, so you can verify the result by hand.

Worked Calculation Examples

ScenarioResultCalculation Step
Study hours vs exam score (hypothetical)r ≈ 0.950n = 8 students. r ≈ 0.950 is a very strong positive linear correlation, and r² ≈ 0.902: about 90% of the variation in scores is linearly associated with study hours in this sample. It does not show that studying caused the higher scores (more motivated students may both study more and score higher), and 8 students is a small sample.
Temperature vs ice cream sales (hypothetical)r ≈ 0.982n = 10 days. Sales rise almost in a straight line with temperature: r ≈ 0.982, very strong and positive. The least-squares line ŷ ≈ −15.3 + 9.27x suggests about 9 more sales per extra degree over this range, but it should not be extended to temperatures far outside 14 to 32 °C.
Shoe size vs exam score (hypothetical)r ≈ −0.052n = 8. r ≈ −0.052 is very weak: little or no linear relationship, as you would expect. It does not prove the variables are unrelated in every way, only that there is no straight-line pattern. With so few points, one value matters: removing point 7 would change r to about −0.30.

What Is Correlation?

Correlation describes how two quantitative variables change together. If taller people tend to weigh more, height and weight are positively correlated; if cars with bigger engines tend to go fewer miles per gallon, engine size and fuel economy are negatively correlated. Correlation needs paired data: each observation gives one X value and one Y value for the same person, day or item.

What Is the Pearson Correlation Coefficient?

The Pearson correlation coefficient, r, is a single number that summarizes the strength and direction of a linear (straight-line) relationship. It always lies between −1 and +1. The sign gives the direction, and the size, |r|, gives how closely the points follow a straight line. r has no units, so it does not change if you convert centimetres to inches or swap which variable you call X and which Y.

Positive, Negative and Zero Correlation

Positive correlation (r > 0): as X increases, Y tends to increase, and the points rise from left to right. r = +1 means every point lies exactly on an upward straight line.

Negative correlation (r < 0): as X increases, Y tends to decrease, and the points fall from left to right. r = −1 means every point lies exactly on a downward straight line.

r = 0 means no linear correlation, not necessarily no relationship. Points in a perfect U-shape, such as y = x² for x from −3 to 3, have r = 0 even though Y is completely determined by X. Always look at the scatter plot as well as the number.

How to Calculate the Correlation Coefficient

1. List the pairs and compute x², y² and xy for each.

2. Add up each column to get Σx, Σy, Σx², Σy² and Σxy, and count the pairs n.

3. Numerator: nΣxy − (Σx)(Σy).

4. Denominator: √([nΣx² − (Σx)²] × [nΣy² − (Σy)²]).

5. Divide: r = numerator / denominator.

Example with X = 1, 2, 3, 4, 5 and Y = 2, 4, 6, 8, 10: Σx = 15, Σy = 30, Σx² = 55, Σy² = 220, Σxy = 110, n = 5. Numerator = 5 × 110 − 15 × 30 = 100. Denominator = √((5 × 55 − 225)(5 × 220 − 900)) = √(50 × 200) = 100. So r = 100 / 100 = 1, a perfect positive correlation. The calculator does this for your data and shows each total.

How to Interpret the Correlation Coefficient

Read the sign first: positive means the variables tend to rise together, negative means one tends to fall as the other rises. Then read the size. A common rule of thumb for |r| is: below 0.20 very weak, 0.20 to 0.39 weak, 0.40 to 0.59 moderate, 0.60 to 0.79 strong, and 0.80 or more very strong. These bands are conventions, not laws; in physics a correlation of 0.9 may be disappointing, while in social science 0.3 can be important.

r² (the coefficient of determination) is the share of the variation in Y that is linearly associated with X in the sample: r = 0.8 gives r² = 0.64, or 64%. It describes the fit of a straight line, not how much X causes Y.

Also consider the sample size. With few pairs, r is unstable, and with 2 pairs it is always exactly ±1.

Correlation Does Not Mean Causation

A strong correlation means two variables tend to move together in a straight-line pattern. It does not show that one causes the other. Possible explanations include:

Direct causation: X really does affect Y.

Reverse causation: Y affects X instead.

A confounding variable: a third factor drives both; ice cream sales and sunburn both rise with hot weather.

Coincidence: with enough variables, some will correlate by chance.

Establishing cause and effect needs study design, such as randomized experiments, and subject knowledge, not a correlation coefficient alone.

When Should You Use Pearson Correlation?

Pearson correlation is designed to measure the strength and direction of a linear relationship between two quantitative variables. Check that:

The data are paired numerical observations, one X and one Y for each case.

The relationship looks roughly like a straight line on the scatter plot. If it curves, r understates it; a U-shaped pattern can give r close to 0.

Both variables vary. If every X (or every Y) is the same, r cannot be calculated.

There are no extreme outliers driving the result. One unusual point can raise or lower r substantially; the calculator flags points whose removal would change r by 0.2 or more.

If the relationship is consistently rising or falling but curved, or the data are ranks, Spearman's rank correlation is often a better choice.

Outliers and Correlation

Because Pearson r uses the actual values, a single extreme point can dominate it. A scattered cloud with r close to 0 can show a clearly positive r after one far-away point is added, and one stray value can weaken an otherwise strong pattern. Before reporting r, look at the scatter plot, check unusual values for data-entry errors, and consider reporting r with and without them. Try it in the interactive demo above.

How to Use the Correlation Calculator

  1. Enter the X values and the Y values, separated by commas, spaces or new lines. The first X pairs with the first Y, the second with the second, and so on, so both lists need the same number of values.
  2. Read the Pearson correlation coefficient r, its direction and strength, r² and the number of pairs n, with a plain-language interpretation.
  3. Check the scatter plot and the dashed least-squares line to see whether a straight line describes the pattern; hover or focus a point to see its exact values.
  4. Look for points flagged as strongly affecting r: removing one of them would change r by 0.2 or more.
  5. Verify the result with the X, Y, X², Y², XY table and the step-by-step substitution into the Pearson formula.

Frequently Asked Questions

What is a correlation coefficient?

A number between −1 and +1 that summarizes how strongly two variables follow a straight-line pattern and in which direction. The Pearson correlation coefficient r is the most common.

What does a correlation of 1 mean?

A perfect positive linear correlation: all the points lie exactly on a straight line that rises from left to right.

What does a correlation of -1 mean?

A perfect negative linear correlation: all the points lie exactly on a straight line that falls from left to right.

What does a correlation of 0 mean?

No linear correlation. There may still be a strong curved relationship; for example, a U-shaped pattern can give r = 0.

What is a strong correlation?

A common rule of thumb calls |r| of 0.60 to 0.79 strong and 0.80 or more very strong, but what counts as strong depends on the field and the purpose.

Does correlation imply causation?

No. Two variables can be correlated because one causes the other, because of reverse causation, because a third variable drives both, or by coincidence. Correlation alone cannot tell these apart.

What is the difference between Pearson and Spearman correlation?

Pearson measures linear correlation using the actual values and is sensitive to outliers. Spearman uses ranks, measures any consistently rising or falling (monotonic) relationship, and is often more robust to outliers.

Can correlation be negative?

Yes. A negative r means Y tends to decrease as X increases; the most negative possible value is −1.

How many data points do I need to calculate correlation?

The formula needs at least 2 pairs, but with 2 pairs r is always ±1. In practice you need many more; with fewer than about 10 pairs, r can change a lot if one value changes.

Can Pearson correlation detect nonlinear relationships?

Not reliably. It measures straight-line association, so curved relationships can give a small r, and a U-shape can give r = 0. Always check a scatter plot.

What does r² mean?

r² is the proportion of the variation in Y that is linearly associated with X in the sample. r = 0.9 gives r² = 0.81, or 81%. It does not measure causation.

Last updated: September 27, 2026.