Introduction: What Are SPL Tokens?
If Ethereum has ERC-20 tokens, Solana has SPL tokens. SPL stands for Solana Program Library, a collection of on-chain programs (smart contracts) that define standards for the Solana ecosystem. The most important of these is the Token Program, which governs how fungible and non-fungible tokens are created, transferred, and managed on Solana.
Unlike Ethereum, where every new token requires deploying a separate smart contract, Solana uses a single, shared Token Program. Every fungible token on Solana โ from USDC to BONK โ is an SPL token managed by this same program. This architecture is what makes Solana token operations incredibly fast and cost-effective.
In this guide, we'll walk through the core concepts, the tooling, and the step-by-step process of creating your own fungible SPL token.
Core Concepts: Accounts, Mints, and Token Accounts
Before writing any code, you need to understand Solana's account model as it relates to tokens.
Mint Account
A Mint Account defines a token type. It stores:
- Supply: The total number of tokens in existence
- Decimals: How divisible the token is (e.g., 9 decimals like SOL, or 6 like USDC)
- Mint Authority: The public key authorized to mint new tokens
- Freeze Authority: The public key authorized to freeze token accounts (optional)
Each unique token has exactly one Mint Account.
Token Account (Associated Token Account)
A Token Account holds a specific user's balance of a specific token. Every wallet that holds your token needs a dedicated Token Account for that mint. The convention is to use Associated Token Accounts (ATAs), which are derived deterministically from the wallet address and the mint address.
Relationship Summary
- 1 Mint Account โ defines the token
- Many Token Accounts โ each holds one wallet's balance of that token
- 1 ATA per wallet per token โ the standard derived account
Token Program vs. Token-2022 (Token Extensions)
Solana currently has two token programs:
- Token Program (
TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA): The original, battle-tested program used by most existing tokens. - Token-2022 / Token Extensions (
TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb): The newer program that adds powerful extensions like transfer fees, confidential transfers, transfer hooks, permanent delegate, and non-transferable tokens.
As of 2025, Token-2022 adoption is growing rapidly, and many new projects choose it for the added functionality. Both programs follow the same core model, but Token-2022 lets you configure extensions at mint creation time.
Step-by-Step: Creating an SPL Token via CLI
The fastest way to create a token is using the Solana CLI and SPL Token CLI.
Prerequisites
- Solana CLI installed (
solana --version) - SPL Token CLI installed (
spl-token --version) - A funded wallet (use
solana airdrop 2on devnet)
`bash
Set to devnet for testing
solana config set --url devnet
`
1. Create the Mint
`bash
spl-token create-token --decimals 9
`
This outputs a Mint Address โ your token's unique identifier. By default, your wallet is set as both the mint authority and freeze authority.
To use Token-2022 instead:
`bash
spl-token create-token --decimals 9 --program-id TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb
`
2. Create a Token Account
`bash
spl-token create-account
`
This creates an Associated Token Account for your wallet.
3. Mint Tokens
`bash
spl-token mint
`
This mints 1,000,000 tokens (in base units) to your token account. With 9 decimals, this equals 0.001 tokens in human-readable terms. To mint 1,000 actual tokens:
`bash
spl-token mint
`
4. Check Your Balance
`bash
spl-token balance
`
5. Transfer Tokens
`bash
spl-token transfer
`
The --fund-recipient flag automatically creates an ATA for the recipient if one doesn't exist.
6. (Optional) Revoke Mint Authority
To make your token supply fixed and immutable:
`bash
spl-token authorize
`
โ ๏ธ This is irreversible. Once revoked, no one can ever mint additional tokens.
Adding Token Metadata
A raw SPL token is just a mint address with no name or logo. To make your token recognizable in wallets and explorers, you need metadata.
The standard approach uses Metaplex Token Metadata Program. You can attach metadata using the Metaplex umi library or CLI tools:
- Name: e.g., "My Project Token"
- Symbol: e.g., "MPT"
- URI: A link to a JSON file containing the token logo and description
For Token-2022, there's a built-in Metadata Extension that avoids the need for Metaplex entirely:
`bash
spl-token create-token --decimals 9 \
--program-id TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb \
--enable-metadata
spl-token initialize-metadata
`
Creating Tokens Programmatically (JavaScript)
For integration into dApps, you'll use @solana/web3.js and @solana/spl-token:
`javascript
import { Connection, Keypair, clusterApiUrl } from '@solana/web3.js';
import { createMint, mintTo, getOrCreateAssociatedTokenAccount } from '@solana/spl-token';
const connection = new Connection(clusterApiUrl('devnet'));
const payer = Keypair.generate(); // Fund this wallet first
// Create mint with 9 decimals
const mint = await createMint(
connection,
payer,
payer.publicKey, // mint authority
payer.publicKey, // freeze authority
9 // decimals
);
// Create ATA for the payer
const tokenAccount = await getOrCreateAssociatedTokenAccount(
connection, payer, mint, payer.publicKey
);
// Mint 1000 tokens
await mintTo(
connection, payer, mint,
tokenAccount.address,
payer, // mint authority
1000 10 * 9
);
`
Best Practices and Security Considerations
- Revoke authorities when appropriate: If your token should have a fixed supply, disable the mint authority. Consider whether you need freeze authority.
- Use Token-2022 for advanced features: Transfer fees, hooks, and confidential transfers are natively supported.
- Always test on devnet first: Token creation costs are minimal (< 0.01 SOL), but mistakes on mainnet are permanent.
- Store metadata on decentralized storage: Use Arweave or IPFS for your token's metadata JSON and image โ not centralized servers.
- Verify on explorers: After creation, check your token on [Solana Explorer](https://explorer.solana.com) or [Solscan](https://solscan.io) to confirm everything looks correct.
Cost Breakdown
Creating an SPL token on Solana is remarkably affordable:
| Action | Approximate Cost |
|---|---|
| Create Mint | ~0.0015 SOL |
| Create Token Account | ~0.002 SOL |
| Mint tokens | ~0.000005 SOL |
| Add metadata | ~0.01 SOL |
Total cost to launch a fully functional token with metadata: under 0.02 SOL (~$3-4 at typical prices).
Conclusion
Solana's SPL token standard offers a streamlined, cost-effective path to creating fungible tokens. Whether you're building a DeFi protocol, launching a community token, or experimenting with tokenomics, the combination of the Token Program (or Token-2022), CLI tools, and JavaScript libraries gives you everything you need. Start on devnet, add proper metadata, and follow security best practices โ and you'll have a production-ready token in minutes, not hours.