What is an IPFS CID?
A Content Identifier (CID) is the unique value used to reference a file or folder stored on IPFS. The CID is derived from the cryptographic hash of the content itself, which has two important consequences:
- The same content uploaded twice produces the same CID.
- Any change to the content — even one byte — produces a different CID.
This makes IPFS content addresses self-verifying: a client can hash what it receives and confirm it matches the CID it asked for.
CID v0 vs. CID v1
| v0 | v1 | |
|---|---|---|
| Length | 46 characters | Variable |
| Encoding | Base58 | Configurable (Base32 default) |
| Prefix | Always Qm | bafy... or bafk... typical |
| Subdomain-safe | No | Yes |
Use CID v1 for new projects. It's required for subdomain gateways and is the IPFS ecosystem default going forward.
Conversion
Many tools can convert between v0 and v1. For example:
v0: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
v1: bafkreidgvpkjawlxz6sffxzwgooowe5yt7i6wsyg236mfoks77nywkptdq
Both refer to the same underlying content.
Using CIDs
Once you have a CID, fetch the content via any IPFS gateway:
https://ipfs.filebase.io/ipfs/{CID}
Or natively in IPFS-aware applications:
ipfs://{CID}
A single CID can address a single file or a directory tree.
CIDs are public
Anything addressable by a CID is public by definition — anyone with the CID can fetch the content from any IPFS gateway. There are no permissions, user accounts, or access controls on CIDs themselves.
For private storage, use the S3-compatible object storage tier with a private bucket and pre-signed URLs.