Covariance Calculator (Stocks)
Calculate covariance and correlation between two stocks from period returns. Measure how two assets move together for diversification and risk analysis.
Sample covariance (%²)
Between -1 and 1
Std dev of returns
Std dev of returns
Period returns (%)
At least 2 period pairs required. Sample covariance and correlation use n−1 denominator. Returns can be in any unit (e.g. % or decimal) as long as both series use the same unit.
What is Stock Covariance?
Covariance measures how two variables (e.g. two stock returns) move together. A positive covariance means the returns tend to move in the same direction; a negative covariance means they tend to move in opposite directions. Covariance is used in portfolio theory to quantify diversification: combining assets with low or negative covariance can reduce portfolio risk.
Correlation is the normalized version of covariance (between -1 and 1), so it is easier to compare across different pairs of stocks. Covariance has units of (% × %), while correlation is unitless.
How to Use This Calculator
- Name your stocks: Optionally label the two assets (e.g. AAPL, MSFT) for clarity in results.
- Enter period returns: For each time period (e.g. month or year), enter the return for Stock A and Stock B in percent. Use the same number of periods for both; add or remove rows as needed.
- Results: The calculator shows sample covariance, correlation (ρ), and the standard deviation of each return series. Covariance and correlation update automatically as you edit.
Why Stock Covariance Matters
Understanding covariance between stocks helps you build diversified portfolios, estimate portfolio variance, and assess how much two positions hedge each other. It is used in modern portfolio theory (MPT), risk budgeting, and correlation-based strategies.
- Diversification: Low or negative covariance between assets reduces portfolio variance for the same expected return.
- Portfolio variance: Portfolio variance depends on weights, individual variances, and pairwise covariances; this calculator gives you the covariance input for two assets.
- Hedging: Negative covariance can indicate assets that offset each other’s moves.
Frequently Asked Questions
What is stock covariance?
Covariance measures how two stock returns move together. A positive covariance means returns tend to move in the same direction; negative covariance means they tend to move in opposite directions. It is used in portfolio theory to quantify diversification.
How do you calculate covariance between two stocks?
Sample covariance is calculated as Cov(X,Y) = Σ(xi - x̄)(yi - ȳ) / (n-1), where xi and yi are period returns and x̄, ȳ are their means. Our calculator uses this formula with the returns you enter.
What is the difference between covariance and correlation?
Covariance has units (e.g. %²) and scale depends on the magnitude of returns. Correlation is the normalized covariance (Cov / (σx σy)), so it is between -1 and 1 and unitless, making it easier to compare across different stock pairs.
Why is stock covariance important for diversification?
Low or negative covariance between assets reduces portfolio variance for the same expected return. Combining stocks that do not move in lockstep smooths returns and lowers overall risk—this is the diversification benefit in modern portfolio theory.
Related Tools
Portfolio Variance Calculator
Calculate portfolio variance and volatility from asset weights and standard deviations. Understand risk and diversification with our free calculator.
Portfolio Beta Calculator
Calculate your portfolio's beta to assess market risk. Weight your assets and determine overall volatility relative to the market.
Portfolio Standard Deviation Calculator
Calculate portfolio standard deviation (volatility) from asset weights and individual volatilities. Measure portfolio risk and diversification instantly.
Forex Correlation Calculator
Discover real-time currency pair correlations. Analyze market relationships, manage risk, and make smarter trading decisions.
Sharpe Ratio Calculator
Measure the risk-adjusted return of an investment portfolio.
Model Risk, Then Build the Strategy
You've measured stock covariance—next, build indicators and strategies that use it. Use Pineify's Pine Script editor and AI to create custom risk and correlation tools on TradingView.