When creating a new account on Solana, how do I calculate the amount of rent (SOL) needed to pay for and create the account?

2 Answers 2


The amount of lamports needed to make an account rent-exempt is based on its size.

  • With the CLI you can use solana rent {bytes}
  • In a solana program, the Rent sysvar is provided. It has a minimum_balance method.
  • In the web3 javascript SDK there is a getMinimumBalanceForRentExemption method for a Connection.

Hey every account needs to pay a rent fee if it does not extends the accumulated rent for two years. The rent depends on the bytes of the account, because it costs the network to save the data I assume.

If you want to know the rent cost for an account you can use

solana rent "byte size of the account"

The minimum sol in an account to be exempt from the rent you can get from the RPC using this method:


For SPL Token accounts this is around 0.002 Sol, that is why you need to pay if you send someone a token he does not have yet. But you can get the sol in there back with if you close the empty account. (With the fee redeemer from SolAndy for example)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.