Skip to content
TraderCalcs.io

Correlation Calculator

Calculate the Pearson correlation between two return series to see how far two positions really move together.

Two holdings that both fall 6% in the same week are, for the purposes of a drawdown, closer to one holding taken twice than to two independent ones. A Pearson correlation calculator puts a number on how much of that shared movement is systematic rather than coincidence: the correlation coefficient runs from −1, where the two move exactly opposite, through 0, where neither tells you anything about the other, to +1, where they move in lockstep.

Formula: r = covariance(x, y) / (standard deviation of x x standard deviation of y)

Your figures

Paired observations

One row per period, with both series measured over the same period. Returns are the usual input, in whichever unit you use for both. Negatives are expected.

Pair 1
Pair 2
Pair 3
Pair 4
Pair 5
Pair 6

Results

Correlation (r)

0.7518

strong positive linear relationship across 6 paired observations

Shared variation (r²)The share of the variation in one series that moves with the other. The rest moves independently of it, or with something this pair does not contain.
56.51%
CovarianceSample covariance, in the two series' units multiplied together. It carries the same sign as r but no fixed scale, which is why it is r and not this that compares one pair against another.
3.9167
Standard deviation, first seriesSample basis, dividing by one fewer than the number of observations.
2.8211
Standard deviation, second seriesSame basis as the first.
1.8468
Mean, first series
+0.9333
Mean, second series
+0.6333
ObservationsPairs with both values filled in. A short record moves the coefficient about a great deal.
6

What this means

Across 6 paired observations the coefficient is 0.7518, which reads as a strong positive linear relationship. It is the covariance of the two series divided by both their standard deviations, and that division is what removes the units: a pair measured in percent and a pair measured in pips both come out on the same −1 to +1 scale. Squaring it gives 56.51%, the share of the variation in one series that moves with the other. What it measures is the straight-line part of the relationship and nothing else — two series that move together along a curve can score close to zero while being entirely dependent on one another.

  • Sample convention throughout: the covariance and both standard deviations divide by one fewer than the number of observations, which is the usual treatment of a record as a sample rather than a whole population. On a short series the difference from the population figure is visible rather than academic.
  • The two series must line up period for period. A single row out of step changes the coefficient, and nothing in the arithmetic can detect it.
  • A correlation is not stable. The figure measured over a calm stretch is frequently not the one that applies during a stressed one, when positions that looked independent turn out to be the same trade — which is the moment the number is usually being relied on.
  • It describes association, not cause, and says nothing about the size of the moves. Two series can be almost perfectly correlated with one moving ten times as far as the other; that relationship is what beta measures.
  • Every valuation, cash flow and observation here is one you enter. Nothing is fetched and no benchmark, index level or rate is assumed, so the answer is only as good as the record it was copied from.

Correlation (r): 0.7518

The link reopens this calculator with the same numbers. Nothing you enter is sent to a server.

About the Correlation calculation

This correlation calculator takes paired observations — one row per period, both series measured over the same period — and returns the coefficient along with r², the sample covariance, the standard deviation and mean of each series, the number of pairs used and a plain description of what the coefficient reads as. Returns are the usual input, in whichever unit you use consistently, and negative values are expected rather than exceptional.

The reason r rather than covariance is the figure people quote is that dividing by both standard deviations removes the units. Covariance carries the two series' units multiplied together and has no fixed scale, so a covariance of 3.9 means nothing until you know what was measured; the same relationship expressed as a correlation of 0.75 compares directly against any other pair, whether one was measured in percent and the other in pips.

It is worth saying at the outset what the coefficient does not do. It measures the straight-line part of a relationship and nothing else, so a pair that moves together along a curve can score close to zero while being completely dependent. And it is not a constant: the coefficient measured over a calm stretch is frequently not the one that applies during a stressed one, which is exactly when a portfolio's assumptions about diversification are being tested.

Correlation formula

mean_x = Σx ÷ n
mean_y = Σy ÷ n

cov  = Σ (x − mean_x)(y − mean_y) ÷ (n − 1)
sd_x = √( Σ (x − mean_x)² ÷ (n − 1) )
sd_y = √( Σ (y − mean_y)² ÷ (n − 1) )

r  = cov ÷ (sd_x × sd_y)
r² = r × r
n
The number of complete pairs entered. Rows with only one of the two values are rejected rather than dropped.
Σ
The sum taken across every pair in the series.
cov
Sample covariance — the average product of the two series' deviations from their own means.
n − 1
The sample denominator, used because a track record is a sample of possible behaviour rather than the whole of it.
r²
The share of the variation in one series that moves with the other; the rest moves independently or with something this pair does not contain.

The heart of the correlation coefficient formula is the product of the two deviations. Each term is positive when both series sit on the same side of their own averages in that period and negative when they sit on opposite sides, so summing them measures how reliably the two are on the same side at the same time. A pair that moves together produces mostly positive products and a large sum; a pair with no relationship produces positive and negative products that largely cancel.

Dividing by both standard deviations is what converts that sum into something comparable. It normalises the relationship by how much each series varies on its own, which strips out the units and bounds the result between −1 and +1. The consequence is worth stating plainly: correlation says nothing whatsoever about the size of the moves. Two series can be correlated at 0.99 with one moving ten times as far as the other, and it is beta, not correlation, that measures that.

The n − 1 denominator appears because the deviations are taken about the sample's own mean rather than the true mean, which makes them systematically slightly too small. Dividing by one fewer than the number of observations corrects for it. In r itself the correction cancels between the numerator and the denominator, so it changes nothing in the coefficient — it matters only to the covariance and the two standard deviations reported alongside it.

Three pairs is the floor because two points always sit exactly on a line, so r on two observations is 1 or −1 whichever way they slope and describes nothing but the fact that two numbers were entered. The coefficient itself is computed from the raw sums of squared deviations rather than by dividing the rounded covariance by the rounded standard deviations, which is algebraically identical but not identical in floating point: the second route returns 0.9999999999999998 for a series correlated with itself.

Correlation: a worked example

Six months of returns on two holdings, in percent: 2.4 and 1.1, then −1.8 and −2.4, 3.1 and 0.8, 0.6 and 2.2, −2.9 and −0.5, and finally 4.2 and 2.6.

  1. Meansmean_x = 5.6 ÷ 6 = 0.9333, mean_y = 3.8 ÷ 6 = 0.6333
  2. Products of the deviations0.6844 + 8.2911 + 0.3611 − 0.5222 + 4.3444 + 6.4244 = 19.5833
  3. Covariance19.5833 ÷ (6 − 1) = 3.9167
  4. Sums of squared deviationsΣ(x − mean_x)² = 39.7933, Σ(y − mean_y)² = 17.0533
  5. Standard deviations√(39.7933 ÷ 5) = 2.8211 and √(17.0533 ÷ 5) = 1.8468
  6. Correlation19.5833 ÷ √(39.7933 × 17.0533) = 19.5833 ÷ 26.0501 = 0.751756
  7. Shared variation0.751756² = 0.5651, shown as 56.51%

r = 0.7518, which the calculator reads as a strong positive linear relationship, with 56.51% of the variation in one series moving with the other and the remaining 43.49% moving independently of it. On six observations, though, that number carries very little weight: a standard interval around it runs from roughly −0.15 to +0.97, which spans nearly the whole scale.

How to use the Correlation calculator

  1. Add one row per period, with both series measured over the same period and the rows kept in the same order. The pairing is the entire calculation — a single row out of step changes the answer and nothing in the arithmetic can detect it.
  2. Use returns rather than prices. Two price series that both drift upwards correlate near 1 almost regardless of how they behave week to week, so a correlation of prices tends to measure the shared trend rather than the shared movement.
  3. Keep each series in a consistent unit. The two series need not share a unit with each other, because the division by both standard deviations cancels them, but mixing percent and decimal returns within one column will not.
  4. Enter at least three pairs, and preferably far more. Blank rows are ignored; a row with only one of the two values is flagged rather than silently dropped, because dropping it would quietly shorten the record.
  5. Read r² next to r. The coefficient sounds stronger than the shared variation does — 0.7 sounds like most of the relationship and corresponds to under half of it — and the second number is usually the more sobering one.
  6. Re-run the same two series over a different window before relying on the figure. A coefficient that changes materially between windows is telling you something the single number cannot.

Limitations of the Correlation calculator

Every calculation makes assumptions. These are the ones that matter here.

  • It measures linear association only. A pair related through a curve — an option position against its own underlying, for instance — can score near zero while being entirely determined by it.
  • Short records move the coefficient a great deal. In the worked example above, six observations produce an interval running from about −0.15 to +0.97, which is barely a statement at all.
  • A single extreme pair can dominate a short series. In that same example one of the six rows contributes 8.29 of the 19.58 sum of products, so 42% of the answer rests on one month.
  • Correlations are unstable, and least stable when it matters. The figure from a calm stretch is often not the figure that applies during a stressed one, when positions that appeared independent turn out to be the same trade.
  • The calculation is contemporaneous only, with no notion of lead or lag. Two series where one reliably moves a period before the other can score close to zero despite an obvious relationship.
  • It describes association rather than cause, and says nothing about the size of the moves involved. Two series can be almost perfectly correlated with one moving ten times as far as the other.
  • The usual interval around a correlation assumes both series are drawn from a joint normal distribution. Return series routinely are not, having fatter tails than that assumption allows, so the interval is optimistic rather than conservative.

Frequently asked questions about Correlation

What counts as a high correlation?

The bands used here are conventional and deliberately coarse: below 0.2 negligible, then weak to 0.4, moderate to 0.6, strong to 0.8 and very strong above it. They describe the coefficient rather than prescribe anything. Whether 0.75 between two holdings is a problem depends entirely on the sizes involved and what the rest of the account is doing, neither of which this calculation knows about.

Can I use this as a forex correlation calculator?

Yes, and as a stock correlation calculator too — the arithmetic knows nothing about what produced the numbers. Two currency pairs' daily returns go into the same columns as two equity holdings' monthly returns, and the coefficient reads the same way in both cases. What does have to hold is the pairing: both series must cover the same periods, which takes more care in FX, where a pair keeps trading through hours an exchange is closed.

Should I use prices or returns?

Returns. Correlating price levels mostly measures whether both series trended in the same direction over the window, which two unrelated rising assets will do. Period returns strip the trend out and measure what the coefficient is meant to measure: whether the two move together in the periods where they move at all.

How many observations do I need?

More than feels necessary. Three is the arithmetic minimum, but the sampling error on a small number of pairs is enormous — six observations leave an interval spanning most of the scale, and even thirty leave a meaningfully wide one. A useful rule is that the coefficient is worth reading when it survives being recomputed on a different window of the same length.

What is the difference between r and r²?

r keeps the direction and runs from −1 to +1; r² discards the sign and gives the share of variation the two series have in common. The gap between them surprises people: a correlation of 0.7, which sounds substantial, corresponds to 49% shared variation, meaning slightly more than half of one series' movement has nothing to do with the other.

Why does the correlation change when I use a different window?

Partly sampling noise and partly genuine change in behaviour, and the two are difficult to separate on any short record. Relationships between assets are driven by conditions — funding, liquidity, the dominant macro concern of the moment — and those conditions change. A coefficient is a description of the window it was measured on, not a property of the pair.

How is correlation different from beta?

Correlation answers how reliably two series move together; beta answers how far one tends to move when the other does. They can point in different directions: a pair can be correlated at 0.95 with a beta of 0.2, meaning the moves are highly consistent but consistently small. Sizing decisions need the second question answered as well as the first.

Can the coefficient be exactly 1 or −1?

Only when every point lies exactly on a straight line, which happens with a series correlated against itself or against a fixed multiple of itself. In real return data it does not occur, and a coefficient arriving at exactly 1 on two supposedly different series is a strong hint that the same column has been entered twice.

Last reviewed . See our methodology and editorial policy.

More performance calculators