Keccak-256 Hash & Selector Generator

Hash text or raw bytes with Keccak-256 — and see the 4-byte function selector alongside it.

0xa9059cbb2ab09eb219583f4a59a5d0623ade346d962bcd4e46b11da047c9049b
0xa9059cbb

One hash, two uses

Keccak-256 always produces the same 32-byte output for a given input — what changes is how you read it. Hash arbitrary data and the full 32 bytes is what you want. Hash a function signature specifically, and the first 4 bytes of that same hash are its selector — the value a contract actually inspects to decide which function you’re calling. There’s no separate algorithm for selectors; it’s the same hash, truncated.

Where this matters in practice

Selectors show up any time you’re reading raw calldata, writing a signature-based access-control check, or verifying that a signature collision (two different function signatures hashing to the same 4-byte selector) isn’t being exploited against a contract. Full hashes show up in Merkle proofs, commit-reveal schemes, and anywhere a contract needs a compact, collision-resistant fingerprint of some data.

How this tool works

Text input is UTF-8 encoded then hashed; hex input is hashed as raw bytes directly — both via viem’s Keccak-256 implementation, entirely in your browser.

Frequently asked questions

Yes — Keccak-256 (not the later-standardized SHA-3, which differs in padding) is what Ethereum uses for addresses, function selectors, event topics, and storage slots. This tool uses viem's implementation, the same library much of the ecosystem's tooling is built on.

The first 4 bytes of the Keccak-256 hash of a function's signature (e.g. transfer(address,uint256)) — it's how a contract call's calldata says which function to run. Type a signature in Text mode and it's shown automatically.

Text mode hashes the UTF-8 bytes of what you type — use it for function signatures or any plain string. Hex bytes mode hashes raw bytes you already have as hex, e.g. hashing existing calldata or a data blob.

No. Hashing happens entirely in your browser via viem — nothing you type is transmitted anywhere.