Use ERC-721 when every token is unique and you want each one to have a single, easily queried owner: 1/1 art, profile-picture collections, names, deeds, positions. Use ERC-1155 when you have many copies of the same item, or a mix of fungible and non-fungible items in one contract: game items, editions, tickets, badges. ERC-721 tracks who owns token #7; ERC-1155 tracks how many of item #7 each address holds, supports batch transfers, and always calls the recipient contract. Both are final Ethereum standards with broad wallet and marketplace support, so the choice comes down to your data model, not popularity.
What each standard actually stores
The difference is one mapping.
An ERC-721 contract keeps tokenId => owner. Every token has exactly one owner, ownerOf(id) returns it, and balanceOf(owner) counts how many distinct tokens an address holds.
An ERC-1155 contract keeps id => (account => amount). A token id is a type, not an individual item. balanceOf(account, id) returns a quantity, and there is no ownerOf, because an id can have thousands of holders. An id becomes "non-fungible" only because your contract mints a supply of one and refuses to mint more. Nothing in the standard enforces that.
| ERC-721 (EIP-721) | ERC-1155 (EIP-1155) | |
|---|---|---|
| Token id means | One unique item | A type of item, with a quantity |
| Ownership query | ownerOf(id) | balanceOf(account, id), no ownerOf |
| Batch operations | Not in the standard | balanceOfBatch, safeBatchTransferFrom |
| Approvals | Per token (approve) and per operator (setApprovalForAll) | Per operator only (setApprovalForAll) |
| Unchecked transfer | transferFrom exists | None: every transfer is "safe" |
| Receiver hook | onERC721Received, only on safe* calls | onERC1155Received / onERC1155BatchReceived, always |
| Name and symbol | name(), symbol() in the metadata extension | Not part of the standard |
| Metadata | tokenURI(id) | uri(id) with {id} substitution |
| Events | Transfer, Approval, ApprovalForAll | TransferSingle, TransferBatch, ApprovalForAll, URI |
When ERC-721 is the better fit
Uniqueness is the product. If each token is distinct and its provenance matters, ERC-721 says so in the data model. ownerOf gives any contract a one-call answer to "who holds this", which is what lending protocols, escrow contracts, token-gated apps and on-chain games usually need. Uniswap v3 liquidity positions are ERC-721 for exactly this reason: each position has different parameters and one owner.
Per-token approval matters. ERC-721 lets an owner approve one specific token to one address. ERC-1155 only has setApprovalForAll, which hands an operator every id the user holds in that contract. For high-value items, the narrower permission is safer, for the same reasons covered in the risks of unlimited ERC-20 approvals.
Tooling expects it. Collection-level name and symbol, per-token metadata, and royalty and metadata-refresh extensions (ERC-2981 for royalty info, ERC-4906 for MetadataUpdate events) are most mature on ERC-721.
A minimal collection with OpenZeppelin Contracts 5.x:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
contract Collection is ERC721, Ownable {
uint256 private _nextId = 1;
string private _base;
constructor(string memory base_, address owner_)
ERC721("Collection", "COL")
Ownable(owner_)
{
_base = base_; // e.g. "ipfs://bafy.../"
}
function mint(address to) external onlyOwner returns (uint256 id) {
id = _nextId++;
_safeMint(to, id); // calls onERC721Received if `to` is a contract
}
// tokenURI(7) returns _base + "7"
function _baseURI() internal view override returns (string memory) {
return _base;
}
}
When ERC-1155 is the better fit
You have quantities. A game with gold, potions and swords; a music release with 500 editions; event tickets in three tiers. With ERC-721, 500 editions means 500 token ids, 500 ownership slots written and 500 Transfer events. With ERC-1155 it is one id, one balance update per holder and one event.
You move many items at once. safeBatchTransferFrom and _mintBatch move several ids in one call and emit one TransferBatch event. A starter pack of ten item types is a single transaction with a single receiver check, which saves gas mainly by avoiding repeated per-call overhead. For more on where those savings come from, see the general techniques for cutting gas in Solidity.
You want fungible and non-fungible items side by side. One contract and one approval cover a game's currency and its unique items, and the receiver hook stops tokens being sent to contracts that can't handle them.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import {ERC1155} from "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import {ERC1155Supply} from "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
contract GameItems is ERC1155Supply, Ownable {
uint256 public constant GOLD = 0; // fungible
uint256 public constant SWORD = 1; // semi-fungible
uint256 public constant CROWN = 2; // one-of-one
constructor(address owner_)
ERC1155("ipfs://bafy.../{id}.json")
Ownable(owner_)
{}
function mintStarterPack(address to) external onlyOwner {
uint256[] memory ids = new uint256[](2);
uint256[] memory amounts = new uint256[](2);
ids[0] = GOLD; amounts[0] = 1_000;
ids[1] = SWORD; amounts[1] = 1;
_mintBatch(to, ids, amounts, "");
}
function mintCrown(address to) external onlyOwner {
require(totalSupply(CROWN) == 0, "crown already minted");
_mint(to, CROWN, 1, "");
}
}
ERC1155Supply adds totalSupply(id) and exists(id), which the base standard lacks. Without it, the contract cannot tell whether a "unique" id has already been minted.
The metadata {id} rule catches people out
An ERC-1155 uri(id) can return one template for every id. Clients replace the literal string {id} with the token id as lowercase hex, zero-padded to 64 characters, without 0x. So for id 1, a wallet requests:
ipfs://bafy.../0000000000000000000000000000000000000000000000000000000000000001.json
If you upload files named 1.json, that URL 404s. Either name the files the way the standard says, or override uri() (OpenZeppelin's ERC1155URIStorage does this) to return a full per-id URI. Whichever you choose, the files have to stay online: pinning NFT metadata on IPFS properly applies to both standards.
Security differences that change your code
ERC-1155 transfers always call the recipient. If to is a contract, the token contract calls onERC1155Received and reverts unless the magic value comes back. ERC-721 only does this through safeTransferFrom and _safeMint; plain transferFrom skips it, which is how ERC-721 tokens end up stuck in contracts that can't move them.
Those callbacks are external calls in the middle of your logic. A mint function that calls _safeMint or _mint (for ERC-1155) and then updates a counter or a per-wallet limit can be re-entered from the receiver hook. Several NFT drops have had their mint caps bypassed exactly this way. Update state first, then mint, and use a guard where it fits; the reentrancy patterns for Solidity apply directly.
Operator approval is all or nothing on ERC-1155. A phishing site that gets a setApprovalForAll signature or transaction can take every id the user holds in that contract. This is true on ERC-721 too, but ERC-1155 gives users no narrower option.
Receiving contracts must implement the right interface. A vault or escrow that accepts ERC-1155 tokens must inherit ERC1155Holder (or implement both hooks and ERC-165) or deposits will revert. For ERC-721, use ERC721Holder if anyone might call safeTransferFrom into it.
What indexers and apps see
On ERC-721, "list everything this wallet owns" is still not an on-chain query unless you add the expensive ERC721Enumerable extension. On ERC-1155 there is no enumeration extension at all, and no on-chain list of an id's holders. In both cases, apps reconstruct ownership from events: Transfer for ERC-721, TransferSingle and TransferBatch for ERC-1155. If you're building that yourself, indexing contract events with The Graph or a custom indexer covers the approach. Note that a batch event carries arrays of ids and values, so your decoder must handle both event shapes.
Quick checks from the command line with Foundry's cast:
# ERC-721: who owns token 7?
cast call $NFT "ownerOf(uint256)(address)" 7 --rpc-url $RPC_URL
# ERC-1155: how many of id 1 does this wallet hold?
cast call $ITEMS "balanceOf(address,uint256)(uint256)" $WALLET 1 --rpc-url $RPC_URL
# Does the contract claim ERC-1155 support? (interface id 0xd9b67a26; ERC-721 is 0x80ac58cd)
cast call $ITEMS "supportsInterface(bytes4)(bool)" 0xd9b67a26 --rpc-url $RPC_URL
What about other options?
- ERC-721A is an ERC-721 implementation, not a new standard. It makes minting several sequential tokens in one transaction much cheaper by writing ownership lazily, at the cost of more expensive first transfers. It is a good fit for large PFP drops where users mint several at once.
- ERC-6909 is a leaner multi-token interface without mandatory receiver callbacks or batch functions, used by Uniswap v4 for internal balances and implemented by OpenZeppelin. It suits protocol accounting more than consumer NFTs, since wallet and marketplace support is thinner.
- Upgradeability works with either standard; if you need it, read how UUPS and transparent proxies work before deploying.
On Ethereum and EVM chains generally, both standards are supported by major wallets and marketplaces, but display quality for ERC-1155 (names, collection grouping, quantities) varies more between apps. Test your collection in the wallets your users actually use before launch.
Checklist
- Every token unique, single owner, contracts need
ownerOf: ERC-721. - Multiple copies, editions, game items, or fungible and unique items together: ERC-1155.
- ERC-1155 metadata: files named as 64-character lowercase hex ids, or override
uri(). - Add
ERC1155Supplyif you need to cap or check the supply of an id. - Update state before
_safeMintor ERC-1155_mint; both call into the recipient. - Receiving contracts inherit
ERC721HolderorERC1155Holder. - Indexers must decode
TransferSingleandTransferBatch, not justTransfer. - Verify the contract and test display in real wallets before launch.
Get the weekly commit
New blockchain deep dives every week.