In practice, a swap is what happens the moment a trader clicks "Confirm" on a decentralized exchange interface: one token leaves the wallet and a different token arrives, settled in a single on-chain transaction with no order book and no counterparty to wait for.
Most swaps run through an Automated Market Maker (AMM), a smart contract holding a pool of two (or more) assets. The pool's ratio, not a matched buy and sell order, sets the price: a formula such as the constant product model recalculates the exchange rate after every trade, so larger swaps move the price more than smaller ones. This is why interfaces show an estimated output, a price impact percentage, and a slippage tolerance before a trade is confirmed; if the price moves past that tolerance before the transaction is mined, the swap simply fails rather than executing at a worse rate.
Because pricing is automatic and permissionless, swaps have become the default way to move between assets on a Decentralized Exchange (DEX), letting anyone trade thousands of tokens, including ones never listed on a centralized platform, directly from a self-custody wallet. Aggregators route a single swap across multiple pools to find the best combined rate, and newer designs add concentrated liquidity ranges or on-chain limit orders to reduce price impact.
The word also covers cases outside AMMs: an Atomic Swap exchanges assets across two separate blockchains without any intermediary, using time-locked contracts so the trade either completes fully on both sides or reverts entirely. Token migrations, where holders swap an old contract's tokens for a new one after a rebrand or upgrade, use the same term for a different, one-time process.