• EasyStackTools191+ Free Tools
    • JSON Formatter
    • JSON Minify
    • Base64 Encoder/Decoder
    • URL Encoder/Decoder
    • Hash Generator
    • Calculate MD2 Hash
    • Calculate MD4 Hash
    • Calculate MD5 Hash
    • Calculate MD6 Hash
    • Calculate RipeMD-128 Hash
    • Calculate RipeMD-160 Hash
    • Calculate RipeMD-256 Hash
    • Calculate RipeMD-320 Hash
    • Calculate SHA1 Hash
    • Calculate SHA2 Hash
    • Calculate SHA-224 Hash
    • Calculate SHA-256 Hash
    • Calculate SHA-384 Hash
    • Calculate SHA-512 Hash
    • Calculate SHA3 Hash
    • Calculate CRC16 Hash
    • Calculate CRC32 Hash
    • Calculate Adler32 Hash
    • Calculate Whirlpool Hash
    • Calculate NTLM Hash
    • Calculate All Hashes at Once
    • HTML Minifier
    • CSS Minifier
    • JavaScript Minifier
    • Regex Tester
    • Diff Checker
    • XML Formatter
    • Markdown Preview
    • User Agent Parser
    • IP Info Lookup
    • URL Analyzer
    • JWT Decoder
    • SQL Formatter
    • Webhook Tester
    • Checksum Address Generator
    • Address Validator
    • Keccak256 Hasher
    • ABI Encoder & Decoder
    • Event Topic Generator
    • Function Selector Generator
    • JSON Escape/Unescape
    • Certificate Decoder
  1. Home
  2. Developer Tools
  3. Function Selector Generator

Function Selector Generator

Generate Ethereum 4-byte function selectors from Solidity function signatures or ABI JSON. Uses keccak256 hashing for accurate function selector values.

Read the guide

The function signature will be normalized to transfer(address,uint256) before hashing.

Common Functions

What is a Function Selector?

A function selector is the first 4 bytes (8 hex characters) of the keccak256 hash of a function's signature. It uniquely identifies a function within a smart contract. When you call a contract function, the selector is included in the transaction calldata to tell the contract which function to execute.

Example: transfer Function

// Function signature
transfer(address,uint256)

// Keccak256 hash
0xa9059cbb...

// Function selector (first 4 bytes)
0xa9059cbb

How is the 4-Byte Selector Calculated?

1

Normalize the Signature

Remove parameter names and whitespace: transfer(address to, uint256 amount) becomes transfer(address,uint256)

2

Compute Keccak256 Hash

Hash the normalized signature using Keccak256 (SHA-3), producing a 32-byte output.

3

Extract First 4 Bytes

Take the first 4 bytes of the hash and convert to hex: 0x + 8 hex characters.

Function Signature Normalization

Function signatures can contain whitespace and parameter names, but only the function name and parameter types matter for selector calculation:

// Original signature (with names and whitespace)
transfer ( address to , uint256 amount )

// Normalized signature (types only)
transfer(address,uint256)

// This normalized form is hashed to produce the selector

Difference: Function Selector vs Event Topic0

Function Selector

First 4 bytes of keccak256 hash. Identifies which function to call in a transaction.

Event Topic0

Full 32-byte keccak256 hash. Identifies which event was emitted in logs.

Frequently Asked Questions

A function selector is the first 4 bytes of the Keccak-256 hash of a Solidity function signature. It uniquely identifies a function in Ethereum smart contracts and is used in contract calls.

Related Tools

  • Event Topic Generator

    Generate Ethereum event topic0 by hashing Solidity event signatures with keccak256. Supports direct signature input and ABI JSON parsing.

  • ABI Encoder & Decoder

    Encode function calls into ABI format or decode ABI-encoded data back into human-readable form. Essential for Ethereum smart contract development.

  • Keccak256 Hasher

    Generate keccak256 hash online instantly. Solidity compatible hashing for Ethereum smart contract development. UTF-8 text and hex input modes.

  • JSON Formatter

    Format and beautify JSON data with proper indentation. Validate JSON syntax and make it readable.