> ## Documentation Index
> Fetch the complete documentation index at: https://docs.raydium.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Swap

> Executing a token swap through the Raydium UI: choose tokens, review the route, set slippage and priority fees, sign, and troubleshoot common failures.

<Info>
  Swap is the most common user operation. This page walks through the Raydium UI flow, explains the settings you can control, and catalogs the failure modes you're likely to hit.
</Info>

## Inputs

Every swap needs:

* **Token in** (mint address + amount)
* **Token out** (mint address)
* **Slippage tolerance** (default 0.5% in the UI; 1% on volatile pairs)
* **Priority fee** (defaults auto-sized)

The amount is specified either as "exact-in" (you set what you pay; output computed) or "exact-out" (you set what you get; input computed). The UI defaults to exact-in.

## UI walkthrough

On [raydium.io/swap](https://raydium.io/swap):

1. **Enter amounts.** Pick input and output tokens; type an amount in either box. The other auto-populates using the current quote.

2. **Review the route.** The route panel shows which pool(s) Raydium picked:

   * Single-pool (most common): "SOL → USDC via CLMM 0.05%"
   * Multi-hop: "SOL → USDC via CPMM, then USDC → RAY via CLMM"
   * Split: "SOL → USDC via 60% CLMM 0.05%, 40% CPMM 0.25%"

   For each hop: the TVL, fee, and expected impact. Bigger trades show a prominent warning when impact exceeds 1%.

3. **Check slippage.** Default is 0.5%. For stable pairs it's 0.1%; for meme tokens 2–5%. If the quote moves while you're looking at it (prices fluctuate), the UI re-quotes every 10 seconds and flashes.

4. **Set priority fee.** Auto by default; three tiers:
   * **Normal** (50th percentile) — default
   * **Fast** (75th percentile)
   * **Turbo** (95th percentile)
     Advanced users can enter a specific micro-lamports/CU number.

5. **Confirm and sign.** Transaction goes out; UI tracks confirmation. Expected time 5–15 seconds on normal congestion.

6. **Post-swap.** UI shows the actual received amount (may differ from quote by up to slippage); click through to the tx explorer for full detail.

## How routing picks a pool

When multiple pools exist for the same pair, Raydium's router picks by:

1. **Highest `amountOut` after fees.** Compute the quote for each eligible pool; pick the one that gives most output.
2. **Tie-break by TVL.** Higher TVL means smaller impact on the next trade — resilient to price fluctuation between quote and submission.
3. **Prefer single-pool over multi-hop.** Multi-hop compounds fees and slippage; the router only picks multi-hop if it beats single-pool by >5 bps.
4. **Split if large.** For trades that are large relative to pool TVL, the route may split across pools to reduce price impact.

Products compared on typical pairs:

* **CPMM pools** dominate at low TVL (`<$1M`) because they're cheap to create and the swap-fee share funds LPs directly.
* **CLMM pools** dominate at medium/high TVL for volatile pairs — concentrated liquidity means better quotes inside the common price range.
* **AMM v4** pools dominate on long-established pairs with deep OpenBook integration (SOL-USDC, RAY-USDC). Most new pairs never touch AMM v4.

## Token-2022 transfer fees

If the input or output mint is Token-2022 with a transfer fee:

* The quote's `amountOut` is the user's net received amount after fee.
* Displayed "fee" in the UI splits into "Pool fee" (LP fee) and "Transfer fee" (paid to mint issuer).

See [`algorithms/token-2022-transfer-fees`](/algorithms/token-2022-transfer-fees).

## Slippage

Slippage protects against adverse price movement between quote and execution. Raydium converts your slippage percentage into a minimum amount you must receive:

```
minimumAmountOut = expectedAmountOut × (1 - slippage)
```

If actual output would be less, the tx reverts with `ExceededSlippage`. Common defaults:

| Pair type                    | Slippage                     |
| ---------------------------- | ---------------------------- |
| Stable-stable                | 0.01–0.1%                    |
| Major-major (SOL/USDC)       | 0.1–0.5%                     |
| Mid-cap volatiles            | 0.5–1%                       |
| Meme tokens                  | 2–5%                         |
| Token-2022 with transfer fee | add transfer fee to slippage |

Too-tight slippage causes frequent reverts under normal price movement. Too-loose slippage invites sandwich attacks (see [`integration-guides/routing-and-mev`](/integration-guides/routing-and-mev)).

## Priority fees

Priority fees pay validators more to process your transaction during congestion. The UI defaults to an automatic setting. Use **Fast** or **Turbo** when the network is busy, when you are swapping a volatile pair, or when a previous transaction expired before confirmation.

Higher priority fees do not improve the quoted price. They only improve the chance that your transaction lands before the quote goes stale.

## Common failure modes

### Tx reverts with `ExceededSlippage`

Price moved more than your tolerance between quote and execution. Fixes:

1. Increase slippage only as much as needed.
2. Reduce trade size (less impact).
3. Re-quote and retry; price may have been transient.
4. Avoid very high slippage on major pairs, because it can expose you to worse execution.

### Tx times out

Priority fee too low for current congestion. Fix: raise priority fee; see `integration-guides/priority-fee-tuning`.

### `InvalidAccountData` on CLMM swap

The route may depend on a CLMM account that failed to load or changed while the quote was open. Refresh the page, re-quote, and retry. If it persists, choose another route if the UI offers one.

### "Pool not found" / stale pool data

Pool was created recently and hasn't indexed yet. Re-fetch by ID directly:
Wait a few minutes, refresh the app, and search by the pool or token mint again. Newly created pools can take a short time to appear in indexed UI search.

### Output is zero / very small

Swap size exceeds pool liquidity. The pool is too shallow; reduce trade size, try another route, or wait for more liquidity.

### Tx lands but balance didn't change

Refresh your wallet and Raydium balances. If the transaction succeeded on the explorer, check whether the output token account is hidden in your wallet UI.

## Verification

Use the transaction link shown by Raydium after confirmation. On Solscan or SolanaFM, check:

* **Status:** Success.
* **Signer:** your wallet address.
* **Token balance changes:** input token decreased, output token increased.
* **Programs invoked:** a Raydium swap program plus token/system programs.

## Pointers

* [`products/cpmm/instructions`](/products/cpmm/instructions) / [`products/clmm/instructions`](/products/clmm/instructions) — per-product swap instruction details.
* [`algorithms/slippage-and-price-impact`](/algorithms/slippage-and-price-impact) — formal definitions.
* [`integration-guides/aggregator`](/integration-guides/aggregator) — routing logic in depth for builders.

Sources:

* [raydium.io/swap](https://raydium.io/swap) — production swap UI.
