When you sell or send away all of a token, the token account that held it does not disappear. It stays in your wallet, empty, still holding its full rent deposit. Closing it is the only way to get that SOL back.
How closing works
Both token programs have a CloseAccount instruction (instruction 9). It takes three accounts:
- The account to close, which must hold zero tokens.
- The destination that receives every lamport in it, usually your wallet.
- The authority that signs: the account’s owner, or a separate close authority if one was set.
The program moves the whole balance to the destination and wipes the account. For a classic account funded at the original price that is 0.00203928 SOL, all of it, not only the part above today’s minimum. Several closes fit in one transaction, so cleaning up dozens of accounts takes a handful of signatures.
What can block a close
- A token balance
- The account must be empty. Send, sell or burn the tokens first.
- Frozen accounts
- The token’s freeze authority has locked the account. Only it can thaw it.
- Token-2022 withheld fees
- Transfer fees collected in the account must be harvested to the mint before it can close.
- Confidential transfers
- Pending or encrypted balances have to be applied and emptied first.
If an account still holds a token you no longer want, you can burn the balance and close the account in the same transaction. Whether that is a good idea depends on what the tokens are worth: Dust and spam tokens covers when burning beats selling. Wrapped SOL is the exception: closing a wrapped SOL account with a balance is allowed, because the balance is SOL, and it unwraps it.
What happens afterwards
- Your history stays. Past transactions are recorded in the ledger, not in the account. Explorers still show them.
- You can receive the token again. The next transfer recreates the associated token account at the same address. Whoever creates it pays the deposit, usually the sender; when you buy, that is you.
- Nothing else changes. Closing one account cannot touch other tokens, other accounts or your SOL balance beyond the deposit coming in.
Close or withdraw?
Closing only works for empty accounts and returns everything. For accounts that still hold tokens you want to keep, the newer WithdrawExcessLamports returns the part of the deposit above today’s minimum and leaves the account open. The two complement each other: a reclaim usually closes the empty accounts and trims the rest.
Doing it
Many wallets have a “close empty accounts” option, and the Solana CLI can close accounts one by one with spl-token close. The UNRENT scanner finds every empty account of a wallet, adds the excess on the
accounts that stay open, simulates the transactions and lets your wallet sign them. What you sign shows the exact instructions.