Logo

Solidity Function Selector

Calculate the 4-byte function selector for any Solidity function signature using keccak256.

Function Selector Calculator

Compute the 4-byte function selector from a Solidity function signature. The selector is the first 4 bytes of the Keccak-256 hash of the canonical signature.

0xa9059cbb
0xa9059cbb2ab09eb219583f4a59a5d0623ade346d962bcd4e46b11da047c9049b

Common Examples

The selector is used in the first 4 bytes of transaction calldata to identify which function to call.

What is a function selector?

When you call a Solidity smart contract, the first 4 bytes of the transaction calldata identify which function to run. This function selector is the first 4 bytes of the Keccak-256 hash of the function's canonical signature — its name followed by its parameter types in parentheses, such as transfer(address,uint256).

The signature must be in canonical form: no spaces, no parameter names, and shorthand types fully expanded (uint becomes uint256, int becomes int256). A signature written differently produces a completely different selector.

Features

  • Compute the 4-byte selector for any Solidity signature
  • Handles multiple signatures in one batch
  • Matches the selectors produced by solc and web3 libraries
  • Useful for verifying calldata and event log decoding
  • Runs fully client-side — no server round-trips

When to use it

Use it when decoding raw calldata from a block explorer, crafting a low-level contract call, checking for selector collisions between overloaded functions, or verifying that a signature like transfer(address,uint256) really does map to 0xa9059cbb.

Privacy & Cookie Preferences

We use cookies to enhance your experience, analyze site performance, and support our marketing efforts. Your privacy matters, and you can withdraw consent at any time.