Crypto & Blockchain How to Calculate Impermanent Loss: A DeFi Liquidity Guide

How to Calculate Impermanent Loss: A DeFi Liquidity Guide

0 Comments

You deposited your crypto into a liquidity pool expecting passive income. Then the price of one token skyrocketed. You check your portfolio, and while you still have money, it feels like you're missing out on gains you could have had by just holding. That nagging feeling? That's Impermanent Loss (IL). It’s not a bug; it’s a feature of how Automated Market Makers (AMMs) work. But before you panic or withdraw your funds, you need to know exactly how much you’ve lost compared to holding. Calculating this isn't just about plugging numbers into a formula; it's about understanding whether your trading fees are actually covering the cost of providing liquidity.

The Core Concept: Why Does This Happen?

Think of an AMM pool as a seesaw with two tokens, say ETH and USDC. The math behind most pools, like Uniswap v2, relies on a constant product formula: $x \times y = k$. Here, $x$ is the amount of Token A, $y$ is the amount of Token B, and $k$ is a constant number that never changes during trades. When someone buys ETH from the pool, they take some ETH out and put USDC in. To keep $k$ the same, the price of ETH inside the pool rises. Arbitrageurs then trade elsewhere to match this price, effectively rebalancing the pool.

This rebalancing is where IL comes in. If you simply held your initial deposit of ETH and USDC, you would have kept all your ETH. But because the pool sold off some ETH as its price rose, you end up with less ETH and more USDC than you started with. If the price reverts to where it was, you get back to square one-hence "impermanent." But if the price stays high when you withdraw, that difference becomes permanent relative to your HODL strategy. It’s an opportunity cost, not necessarily a cash loss, but it matters for your bottom line.

The Standard Formula for 50/50 Pools

For the vast majority of beginners using standard pools like Uniswap v2 or SushiSwap, the calculation is surprisingly straightforward once you understand the variables. You don’t need advanced calculus, just basic algebra. The formula used to determine the percentage of impermanent loss is:

Impermanent Loss Calculation Variables
Variable Definition Example Value
d Price Ratio Change Current Price / Initial Price
IL Impermanent Loss % $2\sqrt{d} / (1+d) - 1$

Let’s break down what $d$ means. If you deposited when ETH was $1,600, and now it’s $2,000, your price ratio change ($d$) is $2,000 / 1,600 = 1.25$. Wait, hold on. In many calculators, $d$ is defined as the inverse or the factor of increase. Let’s stick to the industry-standard interpretation where $d$ represents the factor by which the price has increased. So if ETH goes from $1,600 to $3,200, $d = 2$. If it goes from $1,600 to $4,800, $d = 3$.

Using the formula $IL = \frac{2\sqrt{d}}{1+d} - 1$, let’s run the numbers for a 2x price increase ($d=2$):

  • Square root of 2 is approximately 1.414.
  • Multiply by 2: $2 \times 1.414 = 2.828$.
  • Divide by $(1 + 2)$, which is 3: $2.828 / 3 = 0.9427$.
  • Subtract 1: $0.9427 - 1 = -0.0573$.

This results in a 5.7% impermanent loss. This means your LP position is worth 5.7% less than if you had just held the tokens in your wallet. It sounds small, but on large capital, it adds up quickly.

Real-World Example: ETH/USDC Pool

Imagine you provide liquidity to an ETH/USDC pool. You deposit 1 ETH and $1,600 USDC. At this moment, the total value is $3,200. Suddenly, the market pumps, and ETH hits $2,000. What happens to your position?

Because of the $x \times y = k$ rule, the pool automatically sells some of your ETH to buy more USDC to maintain equilibrium. You no longer have 1 ETH. You might have roughly 0.89 ETH and $1,780 USDC. If you withdrew right then, your total value would be $(0.89 \times 2,000) + 1,780 = $3,560$. If you had held, you’d have 1 ETH ($2,000) and $1,600 USDC, totaling $3,600$. The difference is $40, which is roughly 1.1% of your initial capital. Wait, why the discrepancy with the formula? Because the formula calculates the theoretical divergence loss based purely on price ratios, assuming perfect arbitrage efficiency. In reality, gas fees and slippage can skew exact numbers, but the principle holds: you underperformed the HODL strategy.

A common mistake beginners make is thinking they lost money absolutely. You didn’t lose money; you made money ($3,560 vs $3,200 initial). You just made *less* than you would have by doing nothing. This distinction is crucial for mental health in volatile markets.

Volatility jaguar and stability armadillo dancing around a math orb

Beyond 50/50: Weighted Pools and Curve Finance

Not all pools are created equal. Balancer allows for weighted pools, like 80/20 splits. If you’re in an 80/20 pool, the standard formula doesn’t apply directly because the sensitivity to price changes differs. For an 80/20 pool, the formula adjusts to account for the weights ($w$). Generally, the more asymmetric the weights, the higher the potential IL for a given price move, though it depends on which asset moves.

Then there’s Curve Finance. Curve uses a different bonding curve designed for stablecoins (e.g., USDC/DAI). Since these assets are pegged to $1, their prices rarely diverge significantly. Consequently, IL on Curve is often negligible-sometimes less than 0.1% even during minor depegs. If you’re worried about IL, sticking to stablecoin pairs on Curve is a low-risk strategy compared to volatile pairs on Uniswap.

Uniswap v3: Concentrated Liquidity Complexity

If you use Uniswap v3, things get trickier. V3 introduced concentrated liquidity, allowing you to choose a specific price range to provide liquidity. If the price stays within your range, you earn massive fees. But if the price moves outside your range, your position converts entirely into the worse-performing asset. For example, if you set a range of $1,500-$2,500 for ETH/USDC and ETH drops to $1,000, you’ll end up holding only USDC. Your IL here isn’t just a percentage calculation; it’s a binary outcome of being fully exposed to one asset. Tools like Zapper.fi or Revert Finance are essential here because manual calculation becomes nearly impossible without accounting for the specific bounds you chose.

Multi-headed dragon guarding crypto treasures amidst floating tools

Fees vs. Loss: The Break-Even Point

Here is the million-dollar question: Is IL bad? Not if your fees cover it. Trading fees are paid by traders swapping tokens. These fees accumulate in the pool and are distributed to LPs. To determine if you’re profitable, you must compare your accumulated fees against your calculated IL.

Consider this scenario: You experience 5.7% IL due to a 2x price rise. However, over that same period, the pool generated enough trading volume that you earned 8% in fees. Your net result is a positive 2.3% return compared to holding. Conversely, if you earn only 2% in fees, you have a net loss of 3.7% compared to holding. According to data from Gauntlet Network, only about 27% of liquidity pools generate sufficient fees to overcome typical IL scenarios. This highlights why picking the right pair is critical. High-volume, stable pairs often yield lower APY but safer returns, while volatile pairs offer high APY but carry significant IL risk.

Tools to Simplify the Math

You don’t need to do this by hand every time. Several tools automate these calculations:

  • CoinGecko IL Calculator: Great for quick checks on standard pools. Just input the price change ratio.
  • Zapper.fi: Connects to your wallet and shows real-time IL alongside accrued fees for your actual positions.
  • Revert Finance: Specifically useful for Uniswap v3 users to analyze complex concentrated liquidity positions.

Pro Tip: Always look at the "Net APY" metric provided by these dashboards. It subtracts estimated IL from gross fee earnings. If Net APY is negative, you’re losing money relative to holding.

Common Pitfalls to Avoid

First, don’t withdraw solely because you see IL. Remember, it’s impermanent until you exit. If you believe the price will revert, staying in can turn that paper loss into a gain. Second, ignore the hype around "zero IL" claims. No AMM eliminates IL completely; they just manage it differently. Third, beware of low-cap tokens. While a new meme coin might offer 500% APY, if it crashes 90%, your IL will likely wipe out any fee gains, leaving you holding a bag of worthless tokens.

Is impermanent loss always a loss?

No. It is an opportunity cost compared to holding. You may still make an absolute profit in USD terms, but less than if you had just held the tokens. If trading fees exceed the impermanent loss, you outperform the HODL strategy.

When does impermanent loss become permanent?

It becomes permanent when you withdraw your liquidity from the pool. As long as your funds remain in the pool, the loss is "impermanent" because prices could theoretically revert to their original ratio, restoring your initial token balance.

How do I calculate impermanent loss for a 2x price increase?

For a standard 50/50 pool, a 2x price increase results in approximately 5.7% impermanent loss. The formula is $2\sqrt{d}/(1+d) - 1$, where $d=2$. Plugging in the numbers yields $-0.057$, or 5.7%.

Does Uniswap v3 have more impermanent loss than v2?

Potentially yes, but it also offers more control. In v3, if the price moves outside your selected liquidity range, you convert entirely to the underperforming asset, which can amplify losses compared to v2. However, within the range, capital efficiency is higher, potentially offsetting losses with higher fees.

Can fees cover impermanent loss?

Yes, frequently. In high-volume pools, trading fees can accumulate rapidly. If the total fees earned exceed the percentage of impermanent loss incurred, your position generates a net positive return compared to holding the assets individually.

About the author

Kurt Marquardt

I'm a blockchain analyst and educator based in Boulder, where I research crypto networks and on-chain data. I consult startups on token economics and security best practices. I write practical guides on coins and market breakdowns with a focus on exchanges and airdrop strategies. My mission is to make complex crypto concepts usable for everyday investors.