---
title: How to Calculate Account Creation Cost
description:
  "Every time you create an account, that creation costs an amount of SOL. Learn
  how to calculate how much an account costs at creation."
---

Keeping accounts alive on Solana incurs a data storage cost called
[rent](/docs/core/accounts/account-structure). For the calculation, you need to
consider the amount of data you intend to store in the account. Rent can be
reclaimed in full if the account is closed.

<CodeTabs storage="cookbook" flags="r">

```ts !! title="Kit" file=packages/docs-examples/cookbook/accounts/calculate-rent/kit.ts#region=calc highlight=6

```

```ts !! title="Web3.js v3" file=packages/docs-examples/cookbook/accounts/calculate-rent/web3v3.ts#region=calc highlight=7

```

```rust !! title="Rust" file=packages/docs-examples/cookbook/accounts/calculate-rent/rust/src/main.rs#region=calc

```

```py !! title="Python" file=packages/docs-examples/cookbook/accounts/calculate-rent/python.py#region=calc

```

```go !! title="Go" file=packages/docs-examples/cookbook/accounts/calculate-rent/go/main.go#region=calc

```

```ts !! title="Web3.js (legacy)" file=packages/docs-examples/cookbook/accounts/calculate-rent/legacy.ts#region=calc highlight=7

```

</CodeTabs>
