current location:Home >> Solana Tutorial >> How to Claim SOL from Vacant Token Accounts on Solana

How to Claim SOL from Vacant Token Accounts on Solana

admin Solana Tutorial 1129

If you've been using Solana for a while, you may have accumulated small amounts of SOL stuck in empty token accounts. Here's how to reclaim those funds:


Recommend using GTokenTool to claim your sol tool. You don't need to understand the code, simply fill in the information to recover your sol account. The tool is divided into single wallet and multi wallet


single wallet:https://sol.gtokentool.com/en/walletManagement/rentRecovery

multi wallet:https://sol.gtokentool.com/en/walletManagement/batchRentRecovery

claim sol


Why SOL Gets Stuck in Token Accounts

- Every SPL token account requires a small SOL deposit (0.00203928 SOL) for rent-exemption

- When you empty a token account, this SOL remains locked

- Over time, these small amounts can add up


4 Methods to Reclaim Your SOL


1. Using Solana CLI (Manual Method)

```bash

solana close-empty-token-accounts --keypair ~/path/to/wallet.json

```

This will:

1. Scan your wallet for empty token accounts

2. Close them and return the rent-exempt SOL to your wallet


2. Using Step Finance (Web UI)

1. Go to [https://step.finance](https://step.finance)

2. Connect your wallet

3. Navigate to "Token Accounts"

4. Click "Close Empty" to reclaim SOL


3. Using Solend's Bulk Account Closer

1. Visit [https://solend.fi/bulkclose](https://solend.fi/bulkclose)

2. Connect wallet

3. Approve transactions to close empty accounts


4. Programmatic Approach (For Developers)

```javascript

const { Connection, Keypair, sendAndConfirmTransaction } = require('@solana/web3.js');

const { closeAccount } = require('@solana/spl-token');


async function closeEmptyAccounts() {

  const connection = new Connection('https://api.mainnet-beta.solana.com');

  const wallet = Keypair.fromSecretKey(Uint8Array.from([/ your private key ]));

  

  // Get all token accounts

  const accounts = await connection.getTokenAccountsByOwner(wallet.publicKey);

  

  for (const account of accounts.value) {

    const balance = await connection.getTokenAccountBalance(account.pubkey);

    if (balance.value.amount === '0') {

      await closeAccount(

        connection,

        wallet,

        account.pubkey,

        wallet.publicKey,

        wallet

      );

    }

  }

}

```


Important Notes

- Each closed account returns 0.00203928 SOL

- Closing accounts requires a small SOL fee (about 0.000005 SOL per account)

- For wallets with many empty accounts, you may need to batch transactions


Best Practices

1. Regularly clean up (monthly/quarterly)

2. Use web tools if uncomfortable with CLI

3. Keep 0.1-0.2 SOL in your wallet for transaction fees


Reclaiming these small amounts can surprisingly add up to significant SOL over time!

If you have any questions or uncertainties, please join the official Telegram group: https://t.me/GToken_EN

GTokenTool

GTokenTool is the most comprehensive one click coin issuance tool, supporting multiple public chains such as TON, SOL, BSC, etc. Function: Create tokensmarket value managementbatch airdropstoken pre-sales IDO、 Lockpledge mining, etc. Provide a visual interface that allows users to quickly create, deploy, and manage their own cryptocurrencies without writing code.

Similar recommendations