
On-chain vs off-chain NFT metadata is a question of where the JSON and image behind a token are stored: inside the blockchain, or at an address the contract points to. Most collections keep only that pointer on chain, and the pointer decides who can change or lose your data.
TL;DR:
tokenURI on chain, while the metadata JSON and the media can live on or off chain.data: URI that the contract builds, so nothing outside Ethereum has to stay online.ipfs:// fixes the bytes, while https:// fixes only a location that someone can edit.Updated Nov 30, 2026: moved links onto nouns, dated the gas repricing note, added a takeaway and reasons to Related Reading.
An NFT has three layers, and only the first is always on chain. The token record holds the owner and token ID, the metadata JSON holds a name, description and image link, and the media is what you see.
ERC-721 joins the layers with one optional function, tokenURI(tokenId), which returns a URI that "may point to a JSON file" in the standard's metadata schema. It never says where that file must live, so each project chooses. ERC-1155 does the same through uri(id), with its own placeholder rule for token IDs.
On-chain metadata means the contract returns the JSON itself, usually packed into a data URI. Off-chain metadata means the contract returns a link to JSON on a web server, on IPFS or on Arweave.

We read token #1 from three Ethereum collections on Oct 29, 2026, and you will meet these patterns most. Loot is on chain from end to end, and Bored Ape Yacht Club keeps its JSON and image on IPFS. Cool Cats serves JSON from its own API, with an ipfs.io gateway URL as the image.
A fully on-chain token returns a data URI, the RFC 2397 format, such as data:application/json;base64,.... The JSON inside usually carries an SVG image the same way, so your wallet decodes one string and needs no server or gateway.
Projects rarely store that finished string; they store compact parts and let tokenURI assemble it on every call. Loot #1 returned a 1,681-character URI whose description says the gear is "generated and stored on chain". Nouns keeps its art as run-length-encoded parts compressed with deflate, and its descriptor contract turns them into SVG rectangles, so Noun #1 came back at 14,069 characters.
The reason is cost. A new 32-byte storage slot costs 20,000 gas, so one kilobyte costs 640,000 gas. That price is why most projects store NFT metadata on IPFS and keep only the pointer on chain. Some projects use the SSTORE2 pattern instead, which writes data as contract bytecode, up to the 24,576-byte limit from EIP-170; Nouns stores its compressed art and palettes this way. At 200 gas per byte plus 32,000 gas to create the contract, a kilobyte costs about 237,000 gas.
As of Nov 2026, the next upgrade, Glamsterdam, is scheduled to reprice state growth through EIP-8037, so recheck gas before you budget a fully on-chain mint.
On-chain data can still be swapped out. The Nouns token lets its owner replace the art renderer with setDescriptor until lockDescriptor() is called, so check a contract for setters like this before you call it permanent.
Off-chain metadata lives wherever tokenURI points. OpenSea's storage guide accepts hosted JSON, ipfs://, ar:// for Arweave, data URIs and web3:// URIs, and each off-chain pointer fails in its own way:
| Pointer | Seen on Oct 29, 2026 | What the link fixes | What can break it |
|---|---|---|---|
https:// | Cool Cats #1 tokenURI | A location on one host | The domain lapses, the server moves, or its owner edits the file |
ipfs:// | Bored Ape Yacht Club #1 tokenURI | The exact bytes, through the CID | Every node holding the blocks stops pinning them |
| Gateway URL | Cool Cats #1 image field | The bytes, plus one hostname | That gateway goes away, even while the CID is pinned elsewhere |
data: | Loot #1 tokenURI | The bytes, inside the chain | Only the contract's own logic |
The gap between the first two rows is content addressing. An https:// URL names a place, so the bytes there can change without any trace on chain. An ipfs:// URI names the content by its hash, so you can verify an NFT's CID yourself without trusting a gateway.
A CID proves the bytes are right, and pinning decides whether anyone can fetch them. The CID stays valid forever, but the file is reachable only while some node pins it. That's why IPFS is not permanent by itself, and why an expired pin breaks an IPFS-hosted NFT even though its CID is still correct.
In a 2024 study of top-selling OpenSea NFTs, 38.84% kept their metadata on IPFS, 31.68% on centralized servers and 25.62% fully on chain.
Two things can change, and you should ask about both. Whoever runs the server can replace the bytes behind an https:// URI, while bytes behind ipfs:// or a data URI can't change unless the pointer does.
The pointer itself is the second question. Under ERC-721, "the URI MAY be mutable", and many contracts include an owner-only function that rewrites the base URI. An ipfs:// token is only as fixed as its contract.
When metadata changes on purpose, for a reveal or a game item, ERC-4906 gives marketplaces a standard signal. The contract emits MetadataUpdate(tokenId) or BatchMetadataUpdate(from, to), and OpenSea refreshes the affected items when it sees either event.
One read-only eth_call to tokenURI shows the pattern, so you don't need a wallet or a marketplace. This Python script uses only the standard library and a public RPC endpoint:
import base64, json, urllib.request
RPC = "https://ethereum-rpc.publicnode.com" # any Ethereum mainnet RPC URL
def token_uri(contract, token_id):
call = {"to": contract, "data": "0xc87b56dd" + format(token_id, "064x")} # tokenURI(uint256)
body = json.dumps({"jsonrpc": "2.0", "id": 1, "method": "eth_call", "params": [call, "latest"]})
req = urllib.request.Request(RPC, body.encode(), {"Content-Type": "application/json", "User-Agent": "curl/8"})
raw = bytes.fromhex(json.load(urllib.request.urlopen(req))["result"][2:])
return raw[64:64 + int.from_bytes(raw[32:64], "big")].decode() # decode the ABI string
for name, contract in [("Loot", "0xFF9C1b15B16263C61d017ee9F65C50e4AE0113D7"),
("Bored Ape Yacht Club", "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D"),
("Cool Cats", "0x1A92f7381B9F03921564a437210bB9396471050C")]:
uri = token_uri(contract, 1)
if uri.startswith("data:"):
image = json.loads(base64.b64decode(uri.split(",", 1)[1]))["image"]
print(f"{name} #1: on chain, {len(uri):,} chars, image {image[:26]}...")
else:
print(f"{name} #1: off chain, {uri}")Output (run here, Oct 29, 2026):
Loot #1: on chain, 1,681 chars, image data:image/svg+xml;base64,...
Bored Ape Yacht Club #1: off chain, ipfs://QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/1
Cool Cats #1: off chain, https://api.coolcatsnft.com/cat/1The pointer is only half the answer, so open the JSON and read its image field too. Bored Ape #1 points to another ipfs:// CID, while Cool Cats #1 points to an https://ipfs.io/ipfs/ gateway URL that ties the image to one host. Run this check on your collection before launch, and on any NFT before you buy.
The takeaway: a fully on-chain token depends only on its contract, while an off-chain token also depends on whoever keeps the pointer's target online. On the IPFS route, AIOZ Pin keeps your asset and metadata pinned, and one POST /api/nft/ call pins both files and returns an asset_cid and a metadata_cid.
For a copy you hold yourself, the AIOZ Pin docs export NFT data from the gateway as a CAR file (quoted from the docs, not run here):
curl -X GET 'https://public.aiozpin.network/ipfs/{CID}/?format=car' --output FILENAME.carNext step: read the AIOZ Pin NFT API reference.
Is IPFS on-chain storage?
No. IPFS is a separate peer-to-peer network, so only the ipfs:// string sits on chain while the files live on the nodes that pin them.
Can I move NFT metadata from a web server to IPFS after minting?
Only if the contract lets the owner change the URI; then you pin the JSON and media, update the URI, and emit ERC-4906 events.

An ENS IPFS contenthash points your .eth name at a site on IPFS. See the byte format, a real encoding, ipfs vs ipns records, gas used, and common mistakes.

ERC-721 metadata JSON explained: the three fields EIP-721 defines, OpenSea attributes and animation_url, ipfs:// image links, and folder CIDs for collections.

Merkle DAG vs Merkle tree explained: a tree gives each node one parent and short proofs, while the DAG IPFS uses shares blocks, carries data and links by CID.

IPNI is the IPFS network indexer behind cid.contact. See how index providers publish signed advertisement chains and how one HTTP query finds providers.

On-chain vs off-chain NFT metadata: what the contract stores, what lives on IPFS or a web server, what each costs in gas, and how to check any token yourself.

A Kademlia DHT finds peers by XOR distance. See how k-buckets, k = 20 and iterative lookups let IPFS locate who holds a CID, and how to watch it on Kubo.