> ## Documentation Index
> Fetch the complete documentation index at: https://solana.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# Tokens

> Learn how digital assets are represented on Solana using Token Programs, mint accounts, token accounts, and Token-2022 extensions.

Tokens are digital assets that represent ownership of anything from dollars to
fund shares. On Solana they're called SPL (Solana Program Library) tokens.

<Frame caption="Every balance change goes through the Token Program, which updates the mint and its token accounts.">
  <img className="block dark:hidden" src="/docs-assets/assets/docs/diagrams/assets-overview-light.svg" alt="The Token Program updates a mint and its token accounts while owners authorize balance changes" />

  <img className="hidden dark:block" src="/docs-assets/assets/docs/diagrams/assets-overview.svg" alt="The Token Program updates a mint and its token accounts while owners authorize balance changes" />

  <img className="block dark:hidden" src="/docs-assets/assets/docs/diagrams/assets-overview-sm-light.svg" alt="The Token Program updates a mint and its token accounts while owners authorize balance changes" />

  <img className="hidden dark:block" src="/docs-assets/assets/docs/diagrams/assets-overview-sm.svg" alt="The Token Program updates a mint and its token accounts while owners authorize balance changes" />
</Frame>

<Card title="Create a token with the CLI" href="/developers/docs/tokens/quickstart">
  Create a mint, mint supply, and transfer tokens on devnet from your browser.
</Card>

This page covers how tokens are represented. For code, see
[Token basics](/developers/docs/tokens/basics).

## Key Points

- **Token programs** hold all the instruction logic for tokens, fungible and
  non-fungible.
- A **mint account** represents one token and stores its supply, decimals, and
  authorities.
- A **token account** holds one owner's balance of one mint.
- An **associated token account** is a token account at an address derived from
  the owner and the mint.

## Token Programs

Solana has two token programs:

<Columns cols={2}>
  <Card title="Token Program (Original)" href="https://github.com/solana-program/token">
   - Basic token capability (mint, transfer, etc.)
   - Immutable and widely used
  </Card>

  <Card title="Token Extension Program (Token 2022)" href="https://github.com/solana-program/token-2022">
   - Includes all original Token Program features
   - Adds features through "extensions"
  </Card>
</Columns>

Every mint and token account is a
[data account](/developers/docs/core/accounts/account-types#data-accounts) owned by a
token program.

<Frame caption="Each token program is an executable account owned by the upgradeable loader. Its data stores the address of a program data account, which holds the program code.">
  <img className="block dark:hidden" src="/docs-assets/assets/docs/core/tokens/token-program-light.svg" alt="Each token program is an executable account owned by the upgradeable loader. Its data stores the address of a program data account, which holds the program code." />

  <img className="hidden dark:block" src="/docs-assets/assets/docs/core/tokens/token-program.svg" alt="Each token program is an executable account owned by the upgradeable loader. Its data stores the address of a program data account, which holds the program code." />

  <img className="block dark:hidden" src="/docs-assets/assets/docs/core/tokens/token-program-sm-light.svg" alt="Each token program is an executable account owned by the upgradeable loader. Its data stores the address of a program data account, which holds the program code." />

  <img className="hidden dark:block" src="/docs-assets/assets/docs/core/tokens/token-program-sm.svg" alt="Each token program is an executable account owned by the upgradeable loader. Its data stores the address of a program data account, which holds the program code." />
</Frame>


### Mint Account

A token is identified by the address of its
[mint account](https://github.com/solana-program/token/blob/6d18ff73b1dd30703a30b1ca941cb0f1d18c2b2a/program/src/state.rs#L16-L30),
which stores:

- **Supply**: Total supply of the token
- **Decimals**: Decimal precision of the token
- **Mint authority**: The account authorized to create new units of the token,
  increasing the supply
- **Freeze authority**: The account authorized to freeze tokens in a Token
  Account, preventing them from being transferred or burned

The mint authority is set when the mint is initialized, and doesn't have to be
the account that created or paid for the mint.

<Frame caption="A mint is owned by the Token Program and records supply, decimals, and authorities.">
  <img className="block dark:hidden" src="/docs-assets/assets/docs/core/tokens/mint-account-light.svg" alt="A mint is owned by the Token Program and records supply, decimals, and authorities." />

  <img className="hidden dark:block" src="/docs-assets/assets/docs/core/tokens/mint-account.svg" alt="A mint is owned by the Token Program and records supply, decimals, and authorities." />

  <img className="block dark:hidden" src="/docs-assets/assets/docs/core/tokens/mint-account-sm-light.svg" alt="A mint is owned by the Token Program and records supply, decimals, and authorities." />

  <img className="hidden dark:block" src="/docs-assets/assets/docs/core/tokens/mint-account-sm.svg" alt="A mint is owned by the Token Program and records supply, decimals, and authorities." />
</Frame>

The full details stored on each Mint Account include the following:

```rust title="Mint Account State"
pub struct Mint {
    /// Optional authority used to mint new tokens. The mint authority may only
    /// be provided during mint creation. If no mint authority is present
    /// then the mint has a fixed supply and no further tokens may be
    /// minted.
    pub mint_authority: COption<Pubkey>,
    /// Total supply of tokens.
    pub supply: u64,
    /// Number of base 10 digits to the right of the decimal place.
    pub decimals: u8,
    /// Is `true` if this structure has been initialized
    pub is_initialized: bool,
    /// Optional authority to freeze token accounts.
    pub freeze_authority: COption<Pubkey>,
}
```

For example, see the
[USDC mint account](https://explorer.solana.com/address/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v)
in Solana Explorer.

### Token Account

A [token account](https://github.com/solana-program/token/blob/6d18ff73b1dd30703a30b1ca941cb0f1d18c2b2a/program/src/state.rs#L87-L108)
tracks one owner's balance of one token. It stores:

- **Mint**: The token the Token Account holds units of
- **Owner**: The account authorized to transfer tokens from the Token Account
- **Amount**: Number of the tokens the Token Account currently holds

<Frame caption="A token account records its mint, its owner, and its balance.">
  <img className="block dark:hidden" src="/docs-assets/assets/docs/core/tokens/token-account-light.svg" alt="A token account records its mint, its owner, and its balance." />

  <img className="hidden dark:block" src="/docs-assets/assets/docs/core/tokens/token-account.svg" alt="A token account records its mint, its owner, and its balance." />

  <img className="block dark:hidden" src="/docs-assets/assets/docs/core/tokens/token-account-sm-light.svg" alt="A token account records its mint, its owner, and its balance." />

  <img className="hidden dark:block" src="/docs-assets/assets/docs/core/tokens/token-account-sm.svg" alt="A token account records its mint, its owner, and its balance." />
</Frame>

The full details stored on each Token Account include the following:

```rust title="Token Account State"
pub struct Account {
    /// The mint associated with this account
    pub mint: Pubkey,
    /// The owner of this account.
    pub owner: Pubkey,
    /// The amount of tokens this account holds.
    pub amount: u64,
    /// If `delegate` is `Some` then `delegated_amount` represents
    /// the amount authorized by the delegate
    pub delegate: COption<Pubkey>,
    /// The account's state
    pub state: AccountState,
    /// If is_native.is_some, this is a native token, and the value logs the
    /// rent-exempt reserve. An Account is required to be rent-exempt, so
    /// the value is used by the Processor to ensure that wrapped SOL
    /// accounts do not drop below this threshold.
    pub is_native: COption<u64>,
    /// The amount delegated
    pub delegated_amount: u64,
    /// Optional authority to close the account.
    pub close_authority: COption<Pubkey>,
}
```

A wallet needs a token account, with itself as owner, for each mint it holds. A
wallet can own several token accounts for the same mint, but each token account
has one owner and one mint.

<Frame caption="The Token Program owns mints and token accounts; a token account points to its mint and its owner.">
  <img className="block dark:hidden" src="/docs-assets/assets/docs/core/tokens/token-account-relationship-light.svg" alt="The Token Program owns mints and token accounts; a token account points to its mint and its owner." />

  <img className="hidden dark:block" src="/docs-assets/assets/docs/core/tokens/token-account-relationship.svg" alt="The Token Program owns mints and token accounts; a token account points to its mint and its owner." />

  <img className="block dark:hidden" src="/docs-assets/assets/docs/core/tokens/token-account-relationship-sm-light.svg" alt="The Token Program owns mints and token accounts; a token account points to its mint and its owner." />

  <img className="hidden dark:block" src="/docs-assets/assets/docs/core/tokens/token-account-relationship-sm.svg" alt="The Token Program owns mints and token accounts; a token account points to its mint and its owner." />
</Frame>

<Info>

A token account's `owner` field names who controls the balance. That's
different from the account's program owner, which is always the token
program.

</Info>

### Associated Token Account

An associated token account (ATA) is the "default" token account for an owner
and a mint. It's an ordinary token account at an address derived from the
owner's address and the mint's address, so anyone can find it.

Creating an ATA requires a refundable minimum balance for its account storage.
The instruction's payer funds that balance even when another wallet owns the
ATA. See
[ATA cost and payer](/developers/docs/tokens/basics/create-token-account#cost-and-payer)
for current costs and Token-2022 sizing differences.

The ATA address is a [program-derived address (PDA)](/developers/docs/core/pda):
derived deterministically from fixed inputs.

<Frame caption="An associated token account's address is derived from the wallet and the mint.">
  <img className="block dark:hidden" src="/docs-assets/assets/docs/core/tokens/associated-token-account-light.svg" alt="An associated token account's address is derived from the wallet and the mint." />

  <img className="hidden dark:block" src="/docs-assets/assets/docs/core/tokens/associated-token-account.svg" alt="An associated token account's address is derived from the wallet and the mint." />

  <img className="block dark:hidden" src="/docs-assets/assets/docs/core/tokens/associated-token-account-sm-light.svg" alt="An associated token account's address is derived from the wallet and the mint." />

  <img className="hidden dark:block" src="/docs-assets/assets/docs/core/tokens/associated-token-account-sm.svg" alt="An associated token account's address is derived from the wallet and the mint." />
</Frame>

Each wallet needs its own associated token account for each mint it holds.

<Frame caption="Two wallets and two mints give four associated token accounts, one for each wallet and mint pair.">
  <img className="block dark:hidden" src="/docs-assets/assets/docs/core/tokens/token-account-relationship-ata-light.svg" alt="Two wallets and two mints give four associated token accounts, one for each wallet and mint pair." />

  <img className="hidden dark:block" src="/docs-assets/assets/docs/core/tokens/token-account-relationship-ata.svg" alt="Two wallets and two mints give four associated token accounts, one for each wallet and mint pair." />

  <img className="block dark:hidden" src="/docs-assets/assets/docs/core/tokens/token-account-relationship-ata-sm-light.svg" alt="Two wallets and two mints give four associated token accounts, one for each wallet and mint pair." />

  <img className="hidden dark:block" src="/docs-assets/assets/docs/core/tokens/token-account-relationship-ata-sm.svg" alt="Two wallets and two mints give four associated token accounts, one for each wallet and mint pair." />
</Frame>
