getMinimumBalanceForRentExemption — Solana RPC Method
getMinimumBalanceForRentExemption returns the minimum lamport balance an account needs to hold to be exempt from rent collection, based on the account’s data size. On current Solana, all accounts must be rent-exempt — this method tells you how much SOL that requires.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
dataLength | usize | Yes | The account’s data length in bytes. |
commitment | string | No | processed, confirmed, or finalized. Default: finalized. |
Request
curl -X POST https://api.mainnet-beta.solana.com \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getMinimumBalanceForRentExemption",
"params": [165]
}'
TypeScript (@solana/kit)
import { createSolanaRpc } from "@solana/kit";
const rpc = createSolanaRpc("https://api.mainnet-beta.solana.com");
const minBalance = await rpc
.getMinimumBalanceForRentExemption(165n)
.send();
const sol = Number(minBalance) / 1_000_000_000;
console.log(`Minimum balance for 165 bytes: ${sol} SOL`);
Response
{
"jsonrpc": "2.0",
"result": 2039280,
"id": 1
}
| Field | Type | Description |
|---|---|---|
result | u64 | Minimum balance in lamports for rent exemption at the given data size. |
Common data sizes
| Account type | Data size (bytes) | Approximate rent-exempt minimum |
|---|---|---|
| System account (no data) | 0 | 890,880 lamports (~0.00089 SOL) |
| SPL Token account | 165 | 2,039,280 lamports (~0.002 SOL) |
| SPL Token mint | 82 | 1,461,600 lamports (~0.0015 SOL) |
| Stake account | 200 | 2,282,880 lamports (~0.0023 SOL) |
Common errors
- Invalid data length — negative or excessively large values return an error.
Performance
This method performs a simple calculation based on the rent rate and data size. It is extremely lightweight and returns instantly. The rent rate is a network constant that changes only through governance, so the result for a given data size is effectively stable. Safe to cache indefinitely.
FAQ
Why do accounts need to be rent-exempt? Solana charges rent for storing account data on-chain. Accounts that hold at least the minimum balance for rent exemption are not charged rent. Since 2022, all new accounts on Solana are required to be rent-exempt — accounts below the minimum balance cannot be created.
How is the minimum balance calculated?
The formula is: (128 + dataLength) * rentPerByteYear * 2. The 128 bytes account for the account metadata (pubkey, owner, lamports, etc.). Multiplying by 2 means the balance covers two years of rent, which grants permanent exemption.
Does the minimum balance ever change? Only if the rent rate is changed through a governance vote, which has never happened on mainnet. In practice, the minimum balance for a given data size is constant.
Can I recover the rent-exempt balance? Yes. When you close an account, the remaining lamports (including the rent-exempt minimum) are returned to a specified recipient. This is how SPL Token accounts are closed to reclaim their ~0.002 SOL.
What about zero-data accounts? Even accounts with 0 bytes of data need a minimum balance (approximately 0.00089 SOL) because the account metadata itself occupies space.
Parameters
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
dataLength | usize | Yes | The account's data length in bytes. | — |
commitment | string | No | Commitment level: processed, confirmed, or finalized. | finalized |
Updated: