Skip to content

Correlation Coefficient Calculator

Find the Pearson correlation of two lists of the same length. The lists 1, 2, 3 and 2, 4, 6 move together, so r is 1. Reverse the second list to 3, 2, 1 and r is -1.

Result

Enter two lists

How to Use

  1. 1 Enter the x values, separated by commas or spaces.
  2. 2 Enter the same count of y values, in the same order.
  3. 3 Use at least 2 and at most 30 pairs.

Example Output

  • 1, 2, 3 with 2, 4, 6 gives r = 1.
  • 1, 2, 3 with 3, 2, 1 gives r = -1.

About This Tool

Pearson r divides the sum of paired deviations by the square root of the product of the two summed squares. A list that does not vary has no correlation. The page does not fit a regression line and it does not test significance.

Using the Correlation Coefficient Calculator

This page computes the Pearson correlation of two lists that have the same length. Each x value is paired with the y value in the same position. The result is r. The lists 1, 2, 3 and 2, 4, 6 rise together in a straight line, so r is 1. Reverse the second list to 3, 2, 1 and r is -1. A list that does not vary has no correlation, and the page rejects it instead of printing a number.

You may enter from 2 to 30 numbers in each list, separated by commas or spaces. The lists must match in count. The page does not fit a regression line, does not drop outliers for you, and does not test whether r is statistically significant. The headline is the coefficient for the pairs you typed.

What r Means on This Page

The headline is "r = " and the coefficient. The lines repeat the number of pairs and the same r. Copy keeps both. r near 1 means the pairs rise together. r near -1 means one list rises while the other falls. r near 0 means the straight-line association in this formula is weak. The page does not translate r into a sentence such as "strong" or "weak." You read the number.

The sample r of 1 is exact for 1, 2, 3 against 2, 4, 6. The sample r of -1 is exact for 1, 2, 3 against 3, 2, 1. Those two checks show the sign. A messier list will produce a decimal. That decimal is the value the formula returned for those pairs, rounded by the same arithmetic the page uses everywhere. It is not a probability.

Order matters because pairing is by position. 1, 2, 3 against 2, 4, 6 is not the same as 1, 2, 3 against 6, 2, 4 unless you meant to reorder the pairs.

How the Coefficient Is Computed

Each list is averaged. Each value minus its list mean is a deviation. The deviations are multiplied in pairs and those products are added. Each list of deviations is also squared and added. r is the paired sum divided by the square root of the product of the two squared sums. If either squared sum is 0, every value in that list was the same, and the page stops.

The lists 1, 2, 3 have mean 2. The lists 2, 4, 6 have mean 4. The deviations are -1, 0, 1 and -2, 0, 2. The paired products add to 4. The squared deviations add to 2 and 8. The square root of 2 times 8 is 4. 4 divided by 4 is 1.

A mean of a single list, without a second list, is a different page. The Mean Median Mode Calculator reports mean, median, and mode. It does not pair two lists into r. Use it for one list. Use this page when you have pairs.

What the Coefficient Does Not Claim

r does not say that x caused y. Two lists can move together because of a third thing, or by chance in a short list. The page does not ask what the numbers represent. Hours and scores, or prices and years, are treated as pairs of numbers only.

r does not say the relationship is important. A value can be close to 1 in a tiny sample and still be a thin basis for a decision. Significance tests need a model this form does not run. Do not add "significant" to the headline in a note unless you computed that test somewhere else and say so.

r describes a straight-line association. A curve can be obvious on a plot and still produce a modest r. The page does not draw the plot. If you need the shape, plot the pairs yourself. The coefficient will not mention the curve.

A Line Up and a Line Down

Enter x as 1, 2, 3 and y as 2, 4, 6. The headline is r = 1. The pairs line says 3. Enter y as 3, 2, 1 and leave x alone. The headline is r = -1. The pairs are still 3. Run the first pair of lists again. r returns to 1. The sign follows the second list.

Enter x as 2, 2, 2 and y as 1, 2, 3. The page rejects the run because the x values do not vary. There is no r for a flat list. Entering three x values and two y values is also rejected. The page will not drop the extra x or invent a third y.

How far points sit from their own mean is a different summary. The Mean Absolute Deviation Calculator averages absolute deviations in one list. It does not produce r. Use it for that spread. Use this page for the paired coefficient.

Writing the Pairs So They Can Be Checked

A useful note keeps both lists in order and the headline. "r = 1" without the lists cannot be rebuilt, because many different lines also have r of 1. Write the numbers.

If you sort one list and not the other, you have changed the pairs. Say so. The page pairs by position after you type them, not by size. Sorting both lists independently is a new dataset.

Labels such as "before" and "after" belong in the note. The fields are only called X and Y. The page will not remember that X was a week number.

Mistakes that Change r

Swapping two y values changes the pairs even when the y numbers are the same set. 2, 4, 6 against 1, 2, 3 is the perfect positive sample. 6, 4, 2 against 1, 2, 3 is the perfect negative sample. The same digits, the other order, the other sign.

A blank cell pasted as a word will be rejected, because each entry must be a finite number. Remove the word. Do not expect the page to skip it and compute the rest. Skipping would be a different set of pairs.

Estimating a y between two known points is interpolation, not correlation. The Linear Interpolation Calculator fills one value from a segment. It does not summarize a cloud of pairs. Use it for a gap on a line you already trust. Use this page for r.

How Many Pairs the Form Allows

Two pairs are the minimum. With two points, r is 1 or -1 when the points are not vertical or horizontal in a way that flattens a list, and the page still rejects a list whose values are identical. Thirty numbers is the maximum in each field. A longer study should be split or handled in a tool built for a file. This form is for a list you can read.

Extra spaces and a trailing comma are ignored as separators. 1, 2, 3 and 1 2 3 are the same three numbers. A thousands separator written as 1,000 is not one thousand. The comma splits it into 1 and 000. Write 1000 if you mean one thousand.

Negative numbers are allowed. The sign of a data value is not the sign of r. r's sign comes from whether the deviations move together.

Keeping Both Lists with r

Copy the lists into the note above the headline. If you later drop a pair, run the page again and keep the new r beside the shorter lists. The old r described the old pairs.

A percent gap between two single numbers is not r. The Percentage Difference Calculator compares two values. It does not take lists. Use it for that gap. Use this page when you have a column of pairs.

Reset restores 1, 2, 3 and 2, 4, 6, which is the r = 1 sample. Use that sample when a later decimal looks impossible. If that sample is not 1, the fields are not the sample fields.

What the Page Does Not Do

It does not compute Spearman rank correlation or a partial correlation. It does not remove an outlier. It does not weight the pairs. It does not read a spreadsheet file. Paste the numbers.

It does not report a p-value, a confidence interval, or a slope and intercept. It does not plot. It does not explain causation.

It does not accept a list of 1 number, a mismatched count, or a list that does not vary.

Notes Next to a Coefficient You Keep

Write the lists, the pair count, and r. If you rounded r in a sentence, keep the page's digits in the note. A later reader who reruns the lists should see the same headline.

If you say the relationship is strong, mark that word as your description. The page did not say it. The page said a number.

Do not replace a rejected flat list with r = 0. Zero would mean a defined coefficient. A flat list has an undefined Pearson r, which is why the form stops.

Pairs in Order, Then One Number

The sentence that matches the tool is: "These x values, paired in this order with these y values, have this Pearson r." Anything about cause, a forecast, or a significance test is a further step. Quoting r = 1 as a property of all rising lists is too wide. It is the result for 1, 2, 3 and 2, 4, 6, and for other perfect lines. A list that rises with a bend can have a smaller r. Run that list. Do not borrow the sample.

The arithmetic of the positive sample is short enough to redo by hand. Mean of x is 2. Mean of y is 4. Deviations on x are -1, 0, 1. Deviations on y are -2, 0, 2. Products are 2, 0, 2, and they add to 4. Squares on x add to 2. Squares on y add to 8. The denominator is the square root of 16, which is 4. r is 1. The negative sample flips the y deviations to 2, 0, -2. The products become -2, 0, -2, and they add to -4. Dividing by 4 yields -1. If a handwritten note disagrees with those sums, the note has a different pairing or a different mean.

Checking the Calculator

Enter 1, 2, 3 and 2, 4, 6. Confirm r = 1. Enter 3, 2, 1 as the y list. Confirm r = -1. Enter 2, 2, 2 as the x list. Confirm the page rejects it because the x values do not vary. Enter two y values against three x values. Confirm the page rejects the mismatch.

A single product of two numbers is ordinary multiplication. The 4 Function Calculator multiplies the values you choose. It does not compute Pearson r. Use it for a product. Use this page for paired lists.

Frequently Asked Questions

What does the sample return?

The lists 1, 2, 3 and 2, 4, 6 return r = 1. The lists 1, 2, 3 and 3, 2, 1 return r = -1.

What is r?

The Pearson correlation of the pairs, in the order you typed them.

Does r show causation?

No. The page only computes the coefficient of the numbers.

What if one list is constant?

The page rejects it. A list that does not vary has no Pearson r.

What if the lists have different lengths?

The page rejects them. It does not drop the extra values.

How many numbers can I enter?

From 2 to 30 in each list.

Does order matter?

Yes. Values are paired by position, not sorted.

Will the page skip a word in the list?

No. Every entry must be a finite number.

Does the page draw a plot or a p-value?

No. The headline is r.

Can r be negative?

Yes. The reversed sample is r = -1.

What does copy return?

The headline and the pair count and r lines.

What does reset restore?

X values 1, 2, 3 and Y values 2, 4, 6.