In a simple phrase slippage is the difference between the price you except to get and the price you get when buying or selling a token.
Slippage happens because DEX prices are not fixed they update instantly depending on how much you trade. Here is an example:
When you sell
- You want to sell many tokens
- The liquidity pool is small
- Your sale pushes price down as you execute
- You get less USDC than you expected
Same for when you buy
- You buy a lot
- Price moves up during your purchase
- You get fewer tokens
You can find here a simple slippage calculator i made or you can continue reading to understand what slippage is and how it is calculated
Here is how things work
Liquidity pools on Raydium/Orca use the formula :
x*y=k
x = amount of a token A in pool
y = amount of a token B in pool (SOL/USDC)
K = constant product
When you sell tokens you increase x, which forces y to decrease → price dumps, this is slippage.
Lets get some numbers
Liquidity pool
- $100k liquidity
- 50k in token + 50k in USDC → 250.000.000 tokens and 50.000 USDC
Calculate the price and ratio
USDC reserve / Token reserve → 50.000 USDC / 250.000.000 token = 0,0002 USDC per token
The constant product formula says :
(token_reserve + tokens_sold) × (new_USDC_reserve) = k
Lets say we sell 5.000.000 tokens
New token reserve → 250.000.000 + 5.000.000 = 255.000.000 tokens
k = 250.000.000 x 50.000 = 12.500.000.000.000
new reserve
12.500.000.000 / 255.000.000 = 49.019,61
Former USDC reserve 50.000 , new USDC reserve 49.019,61 the difference is 980,39 USDC. But we sold at 0,0002 and for 5.000.000 we should get 1000 USDC, that is 19,61 USDC less or -1.96%.
So selling 5 mil tokens in a $100k liquidity pool would result to almost 2% slippage.
A general rule is
- Liquidity $100k → Selling 1k = ~2% slippage
- Liquidity $50k → Selling 1k = ~4% slippage
- Liquidity $20k → Selling 1k = ~10% slippage
- Liquidity $10k → Selling 1k = ~20% slippage
- Liquidity <$10k → Your bag will destroy the chart