Compute the 4-byte Ethereum function selector from a Solidity signature using Keccak-256, entirely in your browser. Paste names or types.
Every call to an Ethereum contract starts with 4 bytes that say which function is being invoked, and those 4 bytes aren’t looked up anywhere. They’re computed: the first 4 bytes of Keccak-256 over the function’s canonical signature. Function Selector Calculator computes that directly. The Web Crypto API ships SHA-3, not Keccak, and the two use different padding and produce different digests, so this implements Keccak-f[1600] from scratch rather than reaching for a primitive that would quietly give the wrong answer.
Reach for it when a transaction is reverting and you want to confirm the selector your frontend is sending matches the one the contract expects, or when you’re reading raw calldata and need to know what function it’s calling before decoding the rest. Paste a signature, with or without parameter names, and the selector appears immediately.
Paste transfer(address to, uint256 amount), a signature the way you’d actually see it in Solidity source with parameter names included, and the tool strips those names down to transfer(address,uint256) before hashing, shown above the result as Canonical form. That hashes to 0xa9059cbb2ab09eb219583f4a59a5d0623ade346d962bcd4e46b11da047c9049b, and the first 4 bytes, 0xa9059cbb, are the selector that shows up in the calldata of every ERC-20 transfer ever sent.
Keccak-256 runs 24 rounds of a permutation over a 1600-bit state, absorbing the signature 136 bytes at a time and producing a 32-byte digest; the selector is simply that digest’s first 4 bytes, hex-encoded. This implementation was checked during development against reference digests for the empty string, several real ERC-20 and ERC-721 selectors, and the padding edge cases at exactly one block and one byte short of a block, and it matched every one exactly.
address[], uint256[3], bytes32 all canonicalise correctly, with or without a trailing parameter name.foo((uint256,address),bytes) canonicalises exactly as typed, since that already is the ABI-canonical tuple form.(uint256 a, address b) data, can’t be safely stripped down to its type automatically — the tool shows “Can’t safely strip a named field inside a tuple parameter” rather than silently guessing and risking a wrong selector. Remove the inner names before pasting.Selector (4 bytes)
0xa9059cbbFull Keccak-256
0xa9059cbb2ab09eb219583f4a59a5d0623ade346d962bcd4e46b11da047c9049bPaste a signature with or without parameter names — transfer(address to, uint256 amount) and transfer(address,uint256) hash to the same selector, since the names are stripped before hashing. Tuple and struct parameters aren’t canonicalised; paste those already in their fully qualified form.