the standard · since January 2018
// standard · interface detection · small but everywhere · ready

What is ERC-165?

The tiny function behind interface detection for NFTs, multi-tokens, royalties, and LSPs.

ERC-165 ·EIP-165 ·by Christian Reitwiessner + Nick Johnson + Fabian Vogelsteller + Jordi Baylina + William Entriken

updated · 2 min read · by ercs-solved maintainers

ERC-165 is easy to miss because it is just one function. But it is the reason a marketplace can ask whether a contract is an ERC-721, an ERC-1155, or an ERC-2981 royalty source before it starts calling token-specific functions.

on this page
  1. What is ERC-165?
  2. At a glance
  3. Origin story
  4. The spec
  5. What's broken
  6. It is a claim, not a proof
  7. ERC-20 never adopted it
  8. Interface support can be too coarse
  9. LUKSO alternative
  10. ERC-165 vs ERC725Y
  11. When to use which
  12. FAQ
  13. Sources
  14. Keep reading
at a glance

The standard, in one card.

Standard
ERC-165 / EIP-165
Core function
supportsInterface(bytes4)
Used by
ERC-721 · ERC-1155 · ERC-2981 · LSPs
how the standard came to be

The origin story.#

As Ethereum contracts became more composable, callers needed a standard way to discover interfaces without relying only on ABI registries or failed calls. ERC-165 standardized that discovery path.

the spec, end to end

What ERC-165 actually is.#

ERC-165 EIP-165 interface solidity
function supportsInterface(bytes4 interfaceID) external view returns (bool);
ERC-165 interface, grouped
read: supportsInterface
common callers: wallets · marketplaces · protocol adapters

A contract returns true for the ERC-165 interface ID and for every interface ID it supports. Callers use a static call to supportsInterface and branch from there.

the integration tax

What's broken about ERC-165.#

Interface detection is useful, but it is not a guarantee of behavior. Contracts can lie, implement an interface badly, or support the base interface while leaving important optional behavior out.

  1. It is a claim, not a proof.#

    supportsInterface says what a contract claims to implement. It does not prove the implementation is correct, complete, or safe for the caller's assumptions.

    ERC-165 supportsInterface(id) == true
    claim not behavior proof
    tests probe behavior
    verify defensive
    workarounds tried
    • runtime probing
    • try/catch calls
    • audited implementations
    • conformance tests
  2. ERC-20 never adopted it.#

    The most common token standard predates ERC-165 and does not expose supportsInterface. That is why ERC-20 detection still relies on ABI assumptions, calls, token lists, and indexers.

    ERC-20 no supportsInterface
    heuristic detection
    ERC-165 standard detection
    explicit
    workarounds tried
    • static call balanceOf
    • token lists
    • indexer heuristics
  3. Interface support can be too coarse.#

    A contract can support an interface but still vary in optional extensions, metadata conventions, or permission behavior. Callers still need feature-specific checks.

    interface ID one bytes4
    coarse
    ERC-725Y typed data keys
    richer capability data
    workarounds tried
    • extension-specific IDs
    • metadata reads
    • capability registries
spec to spec, at a glance

ERC-165 vs ERC725Y in one table.#

row ERC-165 ERC-725Y typed data
question answered does this contract claim interface X? what typed data and standards does this account or asset expose?
return type bool bytes under known keys
used by LSPs yes yes, alongside ERC-725Y
be honest about scope

When to use which.#

people also ask

FAQ.#

  • What is ERC-165 used for? #

    It lets contracts declare support for interfaces through supportsInterface(bytes4), so callers can detect standards such as ERC-721, ERC-1155, and ERC-2981.

  • Does ERC-20 support ERC-165? #

    No. ERC-20 predates ERC-165 and does not include supportsInterface in its standard interface.

  • How is an ERC-165 interface ID calculated? #

    An interface ID is the XOR of the function selectors in the interface, with special handling described in the EIP.

primary sources

Where this page draws from.#

  1. EIP-165