Skip to content
ihategas.xyz

Function Selector

Hash a signature, or look up every name that collides on four bytes.

Reads public data

transfer(address,uint256) — or paste 0xa9059cbb

Paste a signature to hash it, or four / thirty-two bytes to look one up.

About function selector

A function selector is the first four bytes of a call's calldata: keccak256 of the signature, truncated. Events use the full thirty-two byte hash as topic0 instead. The mapping only runs one way — computing a selector from a signature is arithmetic, and going back is a dictionary lookup, because four bytes cannot uniquely identify anything. That is not a footnote: a name can be chosen so that it collides with a familiar one, and calldata carrying such a selector is indistinguishable from the real thing until you have the contract's own ABI. So every candidate is listed rather than one being picked, with the ones crafted to collide marked as such. A few hundred common signatures are matched offline; anything else is looked up in Openchain's public database, which receives the four bytes and nothing else.

Common questions

What is an Ethereum function selector?

Four bytes that identify a function call: the leading slice of keccak256 of the canonical signature. Explorers, wallets and this page use that prefix to attach a name to otherwise opaque calldata.

Why can one selector match several function names?

Four bytes are a small space. Different signatures can collide, and malicious contracts sometimes pick a colliding name on purpose. Looking up every known collision shows that ambiguity instead of trusting the first label.

Can I hash a signature here without looking it up?

Yes. Paste a canonical signature and this computes the selector locally; the directory lookup is optional when you want the reverse direction — which names already map to those four bytes.

More developer tools