ERC-721NFT
ERC-721 is the Ethereum standard for non-fungible tokens (NFTs): each token has a unique ID and cannot be swapped one-for-one. ERC-1155 is a later standard that handles both fungible and non-fungible tokens in one contract.
Most tokens are interchangeable: one unit of a stablecoin is as good as any other. ERC-721 is the rulebook for tokens that are not. It defines a small set of functions that every NFT contract on Ethereum (ETH) must offer, so that wallets, marketplaces and block explorers can show who owns which item and move it safely. This entry explains how ERC-721 works, what a token ID is, how approvals can put your NFTs at risk, and how ERC-1155 differs.
- Category
- Cryptocurrency and Blockchain
- Reading time
- 5 min
- Also called
- ERC-1155, NFT standard, Non-fungible token
- Updated
ERC-721 in plain words
ERC-721 is a standard interface that a Smart Contract implements so that each token can be tracked as a unique item.1 The proposal was written by William Entriken, Dieter Shirley, Jacob Evans and Nastassia Sachs and created in January 2018.2
Every NFT has a 256-bit number called the token ID, and the pair of contract address and token ID is unique worldwide.1 The ID must not change for the life of the contract.2
Because each token is distinct, NFTs can stand for things like collectibles, tickets, in-game items or domain names such as Ethereum Name Service (ENS) names.3
How an ERC-721 token works, step by step
A contract defines the collection
One deployed contract holds the whole collection and its ownership records.1
Each item gets a token ID
A token is identified by the contract address plus its uint256 ID.1
Owners are recorded on-chain
ownerOf returns who holds an ID; balanceOf counts how many a wallet holds.2
Transfers emit events
Every move fires a Transfer event that wallets and explorers read.2
Approvals let others move tokens
approve covers one ID; setApprovalForAll lets an operator move all of yours in that contract.2
Metadata points to the content
The optional tokenURI returns a link to a JSON file with name, description and image.2
Worked examples
Example 1 — Identifying one NFT
Unique IDHypothetical: a collection contract holds 10,000 items and you own token ID 7421.
| Identity | Contract address + ID 7421 |
| ownerOf(7421) | Returns your address |
| balanceOf(you) | 1 |
Token 7421 in another contract is a completely different asset, because uniqueness comes from the address and ID together.1
Example 2 — Moving three game items
EfficiencyHypothetical: you send 3 in-game items to a friend.
| ERC-721 | 3 IDs, moved one by one |
| ERC-1155 | 1 safeBatchTransferFrom call |
| Effect | Batching saves gas |
ERC-1155 can move several token IDs and amounts in one call, which costs less gas than separate transactions.4
Example 3 — An approval you forgot
RiskHypothetical: months ago you signed setApprovalForAll for a site you no longer use. You hold 4 NFTs in that collection.
| Operator rights | All tokens in that contract |
| NFTs exposed | 4 of 4 |
| Fix | Revoke the approval |
An operator approved for all can move every token you own in that contract.2 See Token Approval and Wallet Drainer.
ERC-20 vs. ERC-721 vs. ERC-1155
| Aspect | Each unit | Token types per contract |
|---|---|---|
| ERC-20 | Interchangeable | One |
| ERC-721 | Unique ID | One collection |
| ERC-1155 | Fungible or unique | Many, mixed |
Why ERC-721 matters
Collectibles and art
Provably scarce digital items whose ownership anyone can check.3
Tickets and access
Event tickets, attendance proofs and access keys.1
Names and identity
Domain names such as ENS names are issued as NFTs.3
Collateral
Some DeFi apps accept NFTs as collateral.3 See Decentralised Finance (DeFi).
Advantages and disadvantages
Advantages
- One shared interface, so any compliant wallet or marketplace can handle any collection.
- Ownership is public and verifiable on-chain.3
- Safe transfers check that a receiving contract can handle NFTs, which helps stop tokens getting stuck.2
- Creators can program extras such as resale royalties into the contract.3
Disadvantages
Going deeper
Read as far as you need. Each level builds on the one before it.
Fungible vs. non-fungible
Beginner
A fungible token works like cash: any unit can replace any other. A non-fungible token works like a numbered concert seat: seat 12 is not seat 13, even if they cost the same.
Required and optional parts
Intermediate
A compliant contract must implement the ERC-721 interface and ERC-165 interface detection, which lets other contracts ask which standards it supports.2
Metadata (name, symbol, tokenURI) and enumeration (totalSupply and index lookups) are optional extensions.2 Minting and burning are not specified, only the events they should emit.2
Safe transfers and ERC-1155
Advanced
safeTransferFrom calls onERC721Received on a receiving contract and reverts unless it returns a specific value, so tokens are not sent to contracts that cannot handle them.2
ERC-1155, created in June 2018, lets one contract manage many token types, each fungible, non-fungible or semi-fungible, with batch transfers and balance queries.4
The authors rejected storing all metadata on-chain because of the cost, which is why most collections rely on URIs.2
Common mistakes
Assuming the image is on-chain
The token usually stores only a link to the metadata, and that link can change.2
Matching by token ID alone
Token ID 1 exists in thousands of contracts; always check the contract address.
Signing approve-all casually
setApprovalForAll hands over every token in the collection. See Token Approval.
Using transferFrom to a contract
Unlike the safe version, it does not check whether the receiving contract can handle NFTs.2
Check your understanding
Test yourself before moving on. Each answer comes with an explanation.
Key points to remember
- ERC-721 is the Ethereum standard for non-fungible tokens.
- Each NFT is identified by its contract address plus a uint256 token ID.
- Approvals can let others move one token or a whole collection.
- Metadata usually sits off-chain behind a tokenURI.
- ERC-1155 handles many token types and batch transfers in one contract.
Frequently asked questions
Is an NFT the same as ERC-721?
Does owning an ERC-721 token give me copyright?
Can ERC-721 tokens exist on other blockchains?
Further learning
- Smart Contract
The code that implements the standard.
- Token Approval
How approvals work and how to revoke them.
- Block Explorer
Check who owns a token and its transfer history.
Sources
This article is written in our own words. The sources below support the specific facts, rules and figures marked with a number in the text. Links open the original publisher’s page.
- ethereum.org. ERC-721 Non-Fungible Token Standard (opens in a new tab) Checked .
- Ethereum Improvement Proposals. ERC-721: Non-Fungible Token Standard (opens in a new tab) Checked .
- ethereum.org. Non-fungible tokens (NFT) (opens in a new tab) Checked .
- Ethereum Improvement Proposals. ERC-1155: Multi Token Standard (opens in a new tab) Checked .
Educational content, not financial advice. Examples use hypothetical prices and simplified costs; actual fees, margin rules and regulations vary by broker, market and country. We are not affiliated with any publisher linked above. Last reviewed . Report an error or request a source credit.