spl-token CLI
Create SPL Token mints, associated token accounts (ATAs), mint tokens, and transfer balances from the terminal.
Recipe
Quick-reference recipe card - copy-paste ready.
spl-token create-token
spl-token create-account <MINT>
spl-token mint <MINT> 1000
spl-token transfer <MINT> 50 <RECIPIENT_TOKEN_ACCOUNT>When to reach for this:
- Spinning up a devnet test mint before client integration.
- Funding tester wallets with mock tokens.
- Verifying ATA derivation and decimals without TypeScript.
- Manual treasury transfers of SPL tokens.
Working Example
solana config set --url devnet
solana airdrop 2
# Create mint with 6 decimals (common for fungible tokens)
MINT=$(spl-token create-token --decimals 6 | grep "Creating token" | awk '{print $3}')
echo "Mint: $MINT"
# Create ATA for your wallet
spl-token create-account "$MINT"
ATA=$(spl-token accounts --token "$MINT" | grep -v "Token accounts" | awk '{print $1}')
echo "ATA: $ATA"
# Mint 1,000,000 raw units (= 1.0 tokens with 6 decimals)
spl-token mint "$MINT" 1000000
spl-token balance "$MINT"
spl-token supply "$MINT"What this demonstrates:
create-tokeninitializes a new mint with chosen decimals.create-accountcreates the ATA owned by your wallet for that mint.mintincreases supply when your keypair holds mint authority.
Deep Dive
How It Works
- SPL Token program owns mint and token accounts with Borsh-encoded state.
- ATAs are PDAs derived from wallet + mint for deterministic addresses.
- Amounts in CLI use raw integer units - apply decimals mentally.
- Mint and freeze authorities can be revoked after setup.
Common Commands
| Command | Action |
|---|---|
create-token | New mint account |
create-account | ATA for configured owner |
mint | Increase supply (mint authority) |
transfer | Move tokens between token accounts |
authorize | Change or revoke mint/freeze authority |
display | Human-readable mint/account info |
bash Notes
# Transfer to wallet pubkey (CLI resolves ATA)
spl-token transfer "$MINT" 100 <RECIPIENT_WALLET_PUBKEY> --fund-recipient
# Revoke mint authority (fixed supply)
spl-token authorize "$MINT" mint --disableGotchas
- Decimal confusion -
mint 1000with 6 decimals is 0.001 tokens, not 1000. Fix: multiply human amount by 10^decimals. - Missing ATA - transfer fails if recipient has no token account. Fix:
--fund-recipientorcreate-accountfirst. - Wrong mint authority - only the authority keypair can mint. Fix:
spl-token displayto see authorities. - Using solana transfer for tokens - moves SOL, not SPL balances. Fix: always
spl-token transfer. - Frozen accounts - freeze authority can block transfers. Fix: check freeze status with
display.
Alternatives
| Alternative | Use When | Don't Use When |
|---|---|---|
Anchor anchor_spl | Programmatic minting in on-chain code | Quick manual devnet setup |
@solana/kit + Token program | dApp client integrations | One-off CLI experiments |
| Token-2022 extensions | Transfer fees, metadata pointers | Simple fungible MVP |
mucho scaffolds | Full-stack token launch templates | Learning raw SPL layout |
FAQs
How do I choose decimals?
6 or 9 are common (mirroring USDC or SOL divisibility). Decimals are immutable after mint creation.
What is the difference between mint and token account?
Mint defines the token type and supply; token accounts hold balances per owner per mint.
Can I send tokens to a wallet address directly?
Yes with spl-token transfer <MINT> <AMOUNT> <WALLET_PUBKEY> --fund-recipient - the CLI derives or creates the ATA.
How do I see all my token accounts?
spl-token accounts lists ATAs for the configured wallet.
How do I burn tokens?
spl-token burn <TOKEN_ACCOUNT> <AMOUNT> reduces supply if permitted.
Does spl-token ship with Solana CLI?
Yes - installed alongside solana from the Agave release bundle.
How do I make supply fixed?
spl-token authorize <MINT> mint --disable after minting the intended supply.
What is --fund-recipient?
Pays to create the recipient ATA if missing, charged to your fee payer.
Can I use Token-2022?
Use spl-token --program-id TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb for Token-2022 program ID.
How do I inspect a mint?
spl-token display <MINT> shows decimals, supply, and authorities.
Related
- Airdrops & Balances - SOL for fees and rent
- Inspecting Accounts & Programs - raw account bytes
- SPL Token Basics - on-chain token model
- Sending SOL & Transactions - native SOL transfers
Stack versions: This page was written for Agave 4.1.1, Solana CLI 3.0.10, Anchor 0.32.1, anchor-lang 0.32.1, Rust 1.91.1, @solana/kit 7.0.0, Surfpool 0.12.0, and LiteSVM 0.6.x.