Chainlist Decimal vs. Hexadecimal Chain ID for MetaMask
Chainlist decimal vs hexadecimal chain IDs for MetaMask: use decimal for manual settings and hexadecimal for EIP-3085 requests.
The Y News Editors3 min read
Chainlist chain IDs belong in decimal for straightforward manual MetaMask settings, while EIP-3085 network-add requests require a hexadecimal string; the interface determines the format, not the network’s identity. Chainlist’s network handoff sends the network details to a connected wallet, and chainslist.org lets you take that route without retyping the values.
A chain ID is the number that identifies an EVM network to a wallet and its connected applications. Decimal and hexadecimal are two ways to write that same number. Choosing the right notation means matching the format to the field or request you are using.
Should a Chainlist chain ID be decimal or hexadecimal in MetaMask?
For direct entry in MetaMask’s network settings, use the decimal chain ID shown by the blockchain network directory. For a programmatic network-add request, use hexadecimal because EIP-3085 specifies a hexadecimal string for its chainId field.
The two notations suit different interfaces:
- Decimal manual entry: use the ordinary base-ten number when entering network settings yourself. This is the straightforward choice for a wallet user configuring a network directly.
- Hexadecimal API input: use a string beginning with 0x when implementing a wallet_addEthereumChain request under EIP-3085. The wallet API expects that encoding.
- Chainlist directory handoff: choose the wallet handoff when you want the directory to pass the network details to a connected wallet, avoiding manual transcription.
Those choices do not identify different networks. The interface sets the required representation. EIP-1193 uses hexadecimal strings for chainChanged events too, so developers handling that wallet event should expect hexadecimal even though a manual settings field may use decimal.
How do you convert a decimal chain ID to hexadecimal?
To convert a decimal chain ID, express the same number in base 16 and prefix it with 0x. For example, decimal 100 equals hexadecimal 0x64. Both values refer to the same chain ID, written in formats suited to different interfaces.
Adding 0x to a decimal number is not conversion. Writing 0x100 means hexadecimal 100, which equals decimal 256. It does not mean decimal 100. For decimal 100, the correct hexadecimal string is 0x64.
That distinction matters when copying a value into code: converting 100 to 0x64 preserves the chain ID, but simply changing its prefix changes the number. A blockchain network directory can handle the wallet handoff when you want to avoid that transcription step; manual configuration calls for deliberate selection of the decimal value, while an EIP-3085 implementation calls for hexadecimal.
Choose Chainlist’s handoff when you want the directory to send the network details to your connected wallet. Choose decimal for direct manual settings, and hexadecimal when coding an EIP-3085 network-add request.