4Bytes

Compute 4-byte selectors from function signatures, or look up signatures by selector.

e.g. transfer(address,uint256) or function transfer(address,uint256)

About this tool

The 4Bytes selector tool computes the four-byte function selector that prefixes every smart contract call and looks up the original human-readable signature that produced it. It is essential for identifying what an unknown contract interaction is doing.

What a 4-byte selector is

A function selector is the first four bytes of the Keccak-256 hash of a function signature such as transfer(address,uint256). Contracts dispatch calls by matching this selector, so seeing 0xa9059cbb at the start of calldata immediately tells you a standard ERC-20 transfer is happening.

Degenerate formula

Given a signature, the tool hashes it with Keccak-256 and takes the first four bytes. Conversely, given a selector, it can search its lookup for signatures whose hash ends in those same four bytes, revealing the underlying function.

Typical uses

  • Identify calls: Recognize what function an unknown transaction invokes.
  • Build calldata: Quickly obtain the exact selector for an ABI-less interaction.
  • Check collisions: Compare multiple signatures that share the same selector.

Frequently asked questions

Are there selector collisions?

Yes, two signatures can hash to the same four bytes. The lookup reports candidate matches so you can disambiguate.

Does it cover custom functions?

You can compute the selector for any signature you provide, even if it is not in the public lookup.