Compute 4-byte function selectors and event topics from signatures, or look up common selectors.
Loading tool
About Method ID Converter
Compute the 4-byte function selector and the 32-byte event topic0 for Solidity signatures, one per line. Signatures are normalised first: parameter names, the function/event keywords, indexed/memory modifiers and extra spaces are removed, and uint/int become uint256/int256. You can also paste a 0x selector or topic for an offline reverse lookup against a bundled table of common functions and events.
Common uses
- Find the selector for transfer(address,uint256) or any function you are about to call
- Get topic0 for an event to filter logs with eth_getLogs
- Identify an unknown 4-byte selector seen in calldata
- Check for selector clashes between functions in a proxy and its implementation
FAQ
- How is a Solidity function selector calculated?
- It is the first 4 bytes of keccak256 of the canonical signature, e.g. keccak256("transfer(address,uint256)") gives the selector 0xa9059cbb. The canonical form has no spaces or parameter names and uses full type names like uint256.
- What is an event topic0?
- For a non-anonymous event, topic0 is the full 32-byte keccak256 hash of the canonical event signature. Indexed parameters fill the following topics.
- Why does my selector differ from the one I expected?
- Usually the signature is not canonical: using uint instead of uint256 is handled here, but tuple types must be written as (type1,type2) and the parameter types must match exactly.