ForHosting KIT · Finance & money

Impermanent loss calculator

If one token's price doubles against the other, a 50/50 pool position ends about 5.72% behind simply holding the tokens; a fourfold move costs 20%. Enter the starting and later price to see your impermanent loss. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Initial price
100
Final price
200
You get
Price ratio
2
Price change percent
100
Lp value factor
1.414214
Hold value factor
1.5

Liquidity providers on constant-product automated market makers earn swap fees, but they also take a hidden inventory risk called impermanent loss: the gap between the value of tokens left in the pool and the value of the same starting inventory held outside the pool after the price ratio of the two assets moves. Traders, educators, and DeFi dashboards need that gap as a closed-form number, not a Monte Carlo path.

Where impermanent loss comes from

When you add liquidity to a two-token pool that keeps the product of its reserves constant, you deposit equal value of each token. As the price of one token moves against the other, arbitrage rebalances the reserves so their product stays the same and their values match the new price. Compared with simply keeping your starting tokens, your share is then worth less. With k as the new price divided by the old one, the position is worth the deposit times the square root of k, while holding is worth the deposit times one plus k, divided by two. The loss is the first divided by the second, minus one.

Reading the result in practice

The figure is never positive. A price that does not move gives zero, a doubling gives about minus 5.72%, and a fourfold move gives exactly minus 20%. The loss stays on paper while the price can still return to where you entered, and becomes real when you withdraw at the new ratio. Enter a deposit to see the pool value, the holding value and the loss as amounts. The calculation leaves out the trading fees the pool pays you, concentrated ranges, unequal weights and pools with more than two tokens, so compare it with the fees you expect to earn.

What impermanent loss is and how the 50/50 formula works

Impermanent loss is the opportunity cost of providing liquidity to a two-asset constant-product pool—the classic xy equals k automated market maker used by Uniswap v2-style venues—versus simply holding the same starting split of the two tokens. At deposit the pool takes equal value of each asset. The same starting inventory held outside the pool is worth the deposit times one plus k, divided by two.

Dividing those two values and subtracting one yields the textbook identity: IL equals two times the square root of k, divided by one plus k, minus one. The result is always less than or equal to zero. A two-times price change produces about minus 5.72 percent, a four-times change produces exactly minus 20 percent, and an unchanged price (k equals one) produces zero.

The loss is called impermanent because it disappears if the price ratio returns to the entry level before you withdraw; it becomes realized the moment you exit at the new ratio.

Classroom and content widgets

Embed the free browser calculator on education pages so learners verify the classic two-times (−5.72%) and four-times (−20%) textbook cases.

What does the optional deposit field change?

If you omit deposit, those keys are omitted (not null).

Does this include trading fees or Uniswap v3 ranges?

No. The calculator is the textbook 50/50 xy=k identity only. It does not add swap fees, concentrated-liquidity ticks, or unbalanced pool weights.

Why is it called impermanent loss?

Because it disappears if the price ratio returns to where it was when you deposited before you withdraw. It only becomes a realized loss the moment you exit the pool at the new ratio.

Can I see the loss as an amount instead of a percentage?

Yes. Add your starting deposit and the result also shows what the pool position is worth, what simply holding would be worth and the gap between them, all in the same unit as the deposit.

Can impermanent loss ever be positive?

No. The result is always zero or negative: zero when the price has not moved, and a larger loss the further the price ratio drifts from the level at which you deposited.

Which prices should I enter?

The price of one pooled token quoted in the other, first when you deposited and then at the later moment you want to check. A move from 100 to 200 is a ratio of 2; both prices must be above zero.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/finance/crypto-impermanent-loss

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/finance/crypto-impermanent-loss \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"initial_price":100,"final_price":200}'
{
  "initial_price": 100,
  "final_price": 200
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "finance.crypto_impermanent_loss",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

This impermanent loss calculator accepts initial_price and final_price of one pooled asset quoted in the other, optionally a deposit, and returns the price ratio, the signed impermanent-loss fraction and percent, the LP and hold value factors, and—when a deposit is given—the quote-unit LP value, hold value, and loss amount.

What impermanent loss is and how the 50/50 formula works

As the external price of asset A quoted in asset B moves from initial_price to final_price, arbitrage rebalances the reserves so their product stays constant and their value ratio matches the new price. After that move the LP position is worth the original deposit times the square root of k, where k is final_price divided by initial_price. Trading fees, concentrated liquidity, unbalanced weights, and multi-asset pools are out of scope—this endpoint answers the closed-form 50/50 constant-product IL question from a single price-ratio change between the two pooled assets.

Input contract, rounding, and error behaviour

Both must be greater than zero. Optionally send decimals as an integer from zero through eight controlling half-up rounding of every numeric field (default six). Half-up rounding is applied once to each output field from the raw floating computation so goldens stay stable across runtimes. POST a JSON object with two required finite numbers: initial_price, the quote of one pooled asset in the other at deposit, and final_price, the same quote at the later time. Optionally send deposit as a positive finite amount in any quote unit so the response can scale factors into lp_value, hold_value, and impermanent_loss_value; omit deposit and those three keys are omitted rather than returned as null. Numeric strings that parse to finite values are accepted the same way as JSON numbers. Aliases start_price and p0 map to initial_price; end_price and p1 map to final_price; amount and principal map to deposit. Missing fields, non-finite values, non-positive prices or deposit, and out-of-range decimals fail with invalid_input and are not billed. On success the body echoes the rounded prices, price_ratio k, price_change_percent, lp_value_factor (square root of k), hold_value_factor ((1+k)/2), signed impermanent_loss_fraction and impermanent_loss_percent, and a short formula string you can show next to the numbers. Pair this API with your own fee or range module if you need net LP performance; the calculator does not add swap fees or Uniswap v3 ticks.

Where an impermanent loss calculator earns its keep

DeFi education pages and personal-finance blogs rank for impermanent loss calculator when they offer a live tool that matches the story next to the article. Coaching platforms let students enter a textbook two-times or four-times price move and check that the signed percent matches the closed-form identity instead of a simulated path. Wallet onboarding sandboxes show first-deposit IL without standing up a full AMM simulator. Portfolio and analytics scripts mark an LP book to a new ratio and need a deterministic parse endpoint instead of a spreadsheet paste step. Sweep final_price in a loop from your own code to build what-if tables; pin impermanent_loss_percent and, when you send deposit, impermanent_loss_value in tests; keep requests small. The free browser path uses the same pure module as the API, so demo landings and production automation never drift. This tool does not fetch live oracle prices, model concentrated-liquidity ranges, Balancer-style weights, or fee offset—only the closed-form 50/50 constant-product gap between the LP position and holding after one price-ratio change.

Pre-deposit what-if for LPs

Before adding liquidity, enter today's initial_price and a stressed final_price to see signed IL percent and, with deposit, the quote-unit gap versus holding.

LP book mark-to-ratio

Batch-mark pool entries to a new price ratio in ops scripts without a spreadsheet, pinning impermanent_loss_percent in tests.

How do I calculate impermanent loss from a price change?

Send initial_price and final_price (both required, greater than zero). The API sets k = final_price / initial_price and returns IL = 2*sqrt(k)/(1+k) − 1 as a signed fraction and percent for a 50/50 constant-product pool.

Why is impermanent_loss_percent zero or negative?

The closed-form IL versus holding is never positive. It is zero when k = 1 (price unchanged) and negative when the ratio moves either up or down. A two-times move is about −5.72%; a four-times move is exactly −20%.

What does the impermanent loss calculator cost?

The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.

Read the full KIT documentation →