Raydium Swap
Swap any token on Solana — fast and cheap
Swap tokens instantly using Raydium's on-chain liquidity pools. No counterparty required—trades execute directly against smart contracts using automated market maker (AMM) algorithms.
How swaps work
Raydium swaps use liquidity pools rather than order books. Each pool holds reserves of two tokens and uses a mathematical formula to determine prices.
When you swap, you deposit one token into the pool and withdraw another. The pool's algorithm calculates how much you receive based on the current reserves and your trade size.
Constant product formula
Most Raydium pools follow the constant product model: x × y = k
xandyare the reserves of each tokenkis a constant that must remain unchanged after each trade
This formula creates a continuous price curve—the pool always has liquidity available at any price, with the execution rate adjusting dynamically based on your trade size relative to pool depth. Smaller trades execute closer to the spot price, while larger trades have more price impact.
Pool types
CPMM (constant product) — Standard pools using the x·y=k formula. Supports Token-2022 and multiple fee tiers. Default for new pools and LaunchLab migrations.
CLMM (concentrated liquidity) — Liquidity providers choose specific price ranges, improving capital efficiency for stable pairs or actively managed positions. See below.
AMM v4 — Legacy constant product pools. Originally integrated with OpenBook's order book for hybrid liquidity—now functions as a traditional AMM.
Concentrated liquidity
Standard constant product pools spread liquidity across all prices from zero to infinity. This means most capital sits idle at prices far from the current market.
Concentrated liquidity (CLMM) lets liquidity providers allocate capital to specific price ranges. Instead of covering every possible price, LPs choose a lower and upper bound where their liquidity is active.
How it affects swaps
When you swap through a CLMM pool, you're trading against liquidity concentrated around the current price. This typically results in better rates and lower price impact compared to standard pools—assuming sufficient liquidity exists in the active range.
If a large swap moves the price outside the concentrated range, liquidity "runs out" at that tick and the next price range takes over. Very large swaps may cross multiple price ranges, each with different liquidity depths.
Trade-offs
Better capital efficiency means deeper liquidity at active prices
Price impact is generally lower for typical trade sizes
Liquidity can become thin if price moves outside popular ranges
Works especially well for stable pairs (USDC/USDT) where price stays in a tight band
Fees
Swap fees range from 0.01% to 4% depending on the pool:
88% goes to liquidity providers
12% goes to protocol fees (RAY buybacks and treasury)
A small amount of SOL (typically 0.0001–0.001) is required for Solana network fees.
Price impact
Price impact is how much your trade moves the pool price. It's determined by your trade size relative to pool liquidity—larger trades in smaller pools create higher impact.
For example, swapping $100 in a $10M pool has minimal impact. Swapping $100,000 in a $500,000 pool significantly shifts the price against you.
Always check price impact before confirming, especially for large swaps or low-liquidity tokens.
Slippage
Slippage is the difference between the quoted price and execution price. It happens because prices can change between when you submit a transaction and when it confirms on-chain.
Set a slippage tolerance to define the maximum acceptable difference. If the price moves beyond your tolerance, the transaction fails rather than executing at a worse rate.
Too low: Transactions may fail frequently in volatile markets
Too high: Risk of front-running or sandwich attacks extracting value from your trade
Troubleshooting
Transaction timeout — The transaction didn't reach the chain in time. Increase priority fees to improve confirmation speed.

Slippage exceeded — Price moved beyond your tolerance. Either increase slippage or wait for less volatile conditions.

Insufficient SOL — Keep at least 0.05 SOL for network fees.
Last updated
Was this helpful?