What Is the ERC-721 Token Standard and How Does It Work on the Blockchain?

What Is the ERC-721 Token Standard?
ERC-721 is an Ethereum standard for NFTs: unique tokens that you can’t swap one-for-one as if they were all the same. Every NFT has its own number, the tokenId. That lets a contract keep track of exactly which address owns which NFT.
You can compare it to numbered admission tickets. Two tickets can both get you into the same event, but ticket number 14 is technically not the same ticket as number 15. ERC-721 works the same way: each token is registered separately.
An ERC-721 token is identified by two things together: the address of the smart contract and the tokenId. That combination points to one specific token on an Ethereum chain.
The standard gives smart contracts a shared set of rules. That way, a crypto wallet, marketplace, or other app can recognize how to display, look up, and send a compatible NFT. ERC-165 is part of that too. It’s a way for software to check which standard a contract supports.
Important to know: a unique tokenId only means the token is unique within that contract. It does not automatically prove that the linked image, artwork, or physical object is also truly unique or authentic.
Key Takeaways
- ERC-721 is an Ethereum standard for unique, non-fungible tokens.
- Every NFT has its own tokenId within a contract.
- The contract address and tokenId together identify one specific token.
- The standard helps wallets and apps recognize and handle NFTs in the same way.
- A unique tokenId does not automatically prove that the linked work or object is authentic.
How Does the ERC-721 Token Standard Work?
An ERC-721 smart contract keeps track of which blockchain address currently owns each tokenId. With ownerOf(tokenId), you can look up that owner. With balanceOf(address), you can see how many NFTs an address owns in total.
When someone sends an NFT, the contract changes the recorded owner. For that kind of transfer, transferFrom and safeTransferFrom are among the available options.
That second option is usually especially important when you send an NFT to another smart contract. safeTransferFrom checks whether the receiving contract can accept ERC-721 tokens. If it can’t, the transaction gets rolled back. That helps prevent an NFT from getting stuck in a contract that can’t do anything with it.
An owner can also give another address permission:
- With
approve, that address can move one specific tokenId. - With
setApprovalForAll, an operator gets permission to move all ERC-721 tokens owned by that person.
That last permission is pretty broad. Only give that kind of approval to a contract you trust. Permission for one NFT expires once that NFT is transferred.
The contract also stores transfers and approvals in events: notifications in the public blockchain log. Apps can use those to track when an NFT changes hands or when an operator gets permission.
ERC-721 does not define how minting or burning should work. Minting is the creation and issuance of a new token, while burning permanently removes a token from circulation. The contract creator decides who can mint, how many tokens can exist, and whether transfers can be paused temporarily or have fees.
What Are ERC-721 Tokens Used For?
ERC-721 tokens are used for things you want to track individually, because each token can have its own properties or function. Think digital art, collectibles, game items, event tickets, certificates, access tokens, and online identity.
They can also be used to link certain physical assets to a token (think of a house). But there’s an important difference: ERC-721 mainly records who controls the token on the blockchain. Whether that token also gives rights to a ticket, object, or other claim outside the blockchain depends on the creator, the metadata, the contract terms, and any separate agreements.
Because many apps understand the same ERC-721 interface, most applications can in principle recognize and transfer a token. That makes the standard useful in crypto, without every app having to figure out how each NFT collection’s contract works from scratch. That also makes it very easy for people to start their own NFT project.
What Role Do ERC-721 Tokens Play in NFTs?
ERC-721 is a widely used technical foundation for NFTs on Ethereum. The standard handles the core parts: identifying a separate NFT, recording the owner, sending the NFT, and managing permissions.
NFT simply means non-fungible token: a token that is not interchangeable as an equal unit. ERC-721 is not the same as NFT. It is one specific standard you can use to build NFTs. So an NFT can also use a different technical standard.
An ERC-721 contract can also include extra rules. For example, rules for minting, access to certain functions, metadata, or restrictions on transfers.
Royalties are not built into ERC-721 by default. ERC-2981 is a separate standard that lets royalty information be queried. That still does not mean a marketplace will automatically pay that royalty: payment depends on the marketplace or other involved party.
How Are Digital Ownership Rights Recorded?
An ERC-721 contract records which address owns a specific tokenId. Anyone can check that technical ownership record through ownerOf and through the contract’s Transfer events. After all, everything is visible on the blockchain, so the owner of an NFT is usually easy to verify or view. In most cases, the smart contracts used for the NFT collection can also be inspected.
Say tokenId 42 moves from address A to address B. Then address B becomes the recorded owner of tokenId 42. Meanwhile, the contract address and tokenId 42 stay the same technical identification for that token.
The NFT can also have metadata: extra information about the token. Through tokenURI, the contract can point to, for example, a JSON file with a name, description, and a link to an image.
That on-chain ownership is not automatically the same as copyright, intellectual property, or legal ownership of the image, work, or physical object. Owning the NFT does not automatically mean you get all rights to the linked content. Usually, that requires a separate valid agreement.
What Is the Difference Between ERC-721 and ERC-20?
ERC-20 is made for fungible tokens, while ERC-721 is made for non-fungible tokens. Fungible means each unit is equal to every other unit. One ERC-20 token of the same type is therefore equal to another ERC-20 token of that type.
With ERC-20, you send an amount, for example 10 tokens. With ERC-721, you send one specific tokenId, for example token number 42.
Here are the main differences:
- Transfer: ERC-20 is about a number of tokens. ERC-721 is about one unique tokenId.
- Ownership: With ERC-20, an address has a balance. With ERC-721, the contract tracks who owns each tokenId.
- Permission: ERC-20 uses an allowance for a spending amount. ERC-721 can give permission for one NFT or for all of an owner’s NFTs.
- Divisibility: ERC-20 tokens can be sent in amounts. An ERC-721 token is technically one separate tokenId and does not have a standard
decimalsfunction. - Total amount: ERC-20 has
totalSupplyas a standard function. With ERC-721,totalSupplyis only available if the contract uses the optional ERC721Enumerable extension.
Metadata is also optional in ERC-721. So a contract does not necessarily have to offer a name, symbol, or tokenURI, although most NFT contracts do.
How Do You Create an ERC-721 Token?
You create an ERC-721 token by building a smart contract and adding mint logic to it. ERC-721 itself does not provide a ready-made public mint function, so the developer decides how new tokens are created.
In practice, it usually works like this:
-
Build or use an ERC-721 contract A developer writes a smart contract in Solidity that supports ERC-721 and ERC-165. Often, a tested base implementation like OpenZeppelin ERC721 is extended instead of writing everything from scratch.
-
Set the minting rules The contract has to decide who can mint, how tokenIds are issued, whether there is a maximum number of tokens, and whether minting costs money. Access control belongs here too: not everyone should automatically be able to create new NFTs.
-
Assign a new tokenId For every new NFT, the contract has to use a tokenId that does not already exist. That tokenId is assigned to a valid address, not to an empty address.
-
Use safe minting when possible
_safeMintchecks, when the recipient is itself a smart contract, whether that contract can receive ERC-721 tokens. That lowers the chance that a fresh NFT gets stuck with the recipient. -
Deploy and execute transactions After deployment on an EVM chain, minting, transfers, and approvals are carried out as blockchain transactions. The costs and risks depend on the chosen chain and especially on the code in the contract.
Copying a contract is not enough for safe use. Extra logic for payments, whitelists, upgrades, or royalties can add new vulnerabilities. Testing and, where appropriate, an independent security audit are therefore important.
What Parts Does an ERC-721 Smart Contract Include?
An ERC-721 smart contract has to provide a fixed core set of functions and events. That fixed interface makes sure other apps know how to work with the NFTs.
The required parts include:
balanceOf: looks up how many NFTs an address owns.ownerOf: looks up which address owns a specific tokenId.transferFromandsafeTransferFrom: send an NFT to another address.approveandgetApproved: manage and check permission for one specific NFT.setApprovalForAllandisApprovedForAll: manage and check permission for all NFTs owned by one person.Transfer,Approval, andApprovalForAll: events that let apps track transfers and permissions.supportsInterface: the ERC-165 function that lets apps check that the contract supports ERC-721.
There are also optional extensions. ERC721Metadata adds name, symbol, and tokenURI. ERC721Enumerable adds, among other things, totalSupply and functions for listing tokenIds.
In addition, a practical contract often has its own functions, such as a mint function, admin roles, sale rules, a base URI, or a burn function. ERC-721 does not specify how the contract stores data internally, such as owners and permissions. The standard is about what the contract must be able to do externally.
How Is Metadata Linked to an ERC-721 Token?
Metadata is usually linked through tokenURI(tokenId), an optional function that returns a reference to information about one specific NFT. That URI can point to a JSON file, for example.
That JSON file can include fields like name, description, and image. An NFT marketplace or crypto wallet can use that data to show the token’s name, description, and image. Since each NFT has its own stats, you can think of it as a kind of collectible card. Some collectible cards are unique and rare, while some are common. That is also generally how the value of NFTs is determined.
A developer can store a separate URI for each NFT. Another option is to use a base URI and add a unique number or path for each token. OpenZeppelin includes ERC721URIStorage with _setTokenURI for this.
Important to keep in mind: ERC-721 does not require metadata to be permanent or unchangeable. A URI is a text reference to data outside the blockchain. Who can change the URI and where the content is stored depends on the contract and storage setup. So an image or JSON file may be able to change or may no longer be available.
What Are the Advantages and Disadvantages of ERC-721?
ERC-721 is useful because it offers a clear, shared way to create unique tokens on Ethereum. But the standard does not solve every NFT-related problem.
Advantages:
- Interoperability: wallets, brokers, auctions, and other apps can recognize and handle ERC-721 NFTs in a predictable way.
- Traceability: for each tokenId, you can see which address owns it and what transfers have happened.
- Flexible permissions: you can give an address permission for one NFT, or an operator for all your NFTs.
- Expandable: metadata and enumeration are optional. So a contract can stay small or add extra features.
Disadvantages and risks:
- A lot of power with
setApprovalForAll: an approved operator can move all ERC-721 tokens from your address. Check those permissions regularly and only give them to trusted contracts. - Risk with
transferFrom: an NFT can get stuck if the receiving contract cannot handle the NFT.safeTransferFromchecks that better, but the extra external call can create a reentrancy risk. That is when another contract tries to call a function again during execution. - Higher costs with enumeration: ERC721Enumerable is often not used because listing tokens on-chain can cost a lot of extra gas.
- No guarantee outside the blockchain: ERC-721 does not automatically prove copyright, authenticity of claims, permanent metadata, or mandatory royalty payments.
In short: ERC-721 provides a technical base for ownership and transfer of an NFT. Whether a collection is also secure and what rights are actually attached depends on the contract code, admin rights, metadata, and agreements outside the blockchain.
Conclusion
ERC-721 is the Ethereum standard that gives NFTs their own identity. A smart contract records who owns each tokenId, how an NFT is transferred, and who has permission to do so.
That makes ERC-721 useful for things like digital art, game items, tickets, and access tokens. At the same time, an NFT is not automatically proof of copyright, authenticity, or legal ownership of what it is linked to. So don’t look only at the NFT itself, but also at the contract rules, the metadata, and the permissions you give to a contract.