Free online tools to generate, calculate,
convert, format, encode, and play.
 

ENS Namehash Calculator

Compute the namehash for any ENS name, useful for interacting directly with the ENS registry contract.


Namehash

Enter a full ENS name (e.g. vitalik.eth, sub.name.eth)
The namehash updates as you type.

Examples


How It Works

The namehash algorithm (defined in EIP-137) converts human-readable ENS names into a fixed-length bytes32 identifier that the ENS registry smart contract uses internally. Every ENS name maps to exactly one namehash, and the process is deterministic and irreversible.

Algorithm

The name is split by dots into labels, then hashed recursively from right to left using Keccak-256:

namehash("")            = 0x0000...0000  (32 zero bytes)
namehash("eth")         = keccak256(namehash("") + keccak256("eth"))
namehash("name.eth")    = keccak256(namehash("eth") + keccak256("name"))
namehash("sub.name.eth")= keccak256(namehash("name.eth") + keccak256("sub"))

Step by Step

  1. Normalize — Convert the name to lowercase (full UTS-46 normalization is recommended for production use).
  2. Split — Break the name into labels at each dot: "vitalik.eth" → ["vitalik", "eth"].
  3. Start with zero node — Begin with 32 zero bytes (0x00...00).
  4. Iterate right-to-left — For each label (starting from the rightmost), compute keccak256(currentNode + keccak256(label)).
  5. Result — The final 32-byte value is the namehash, used as the key in the ENS Registry.

Why Namehash?

  • Fixed size — Any name, regardless of length, maps to a 32-byte identifier suitable for use as a mapping key in Solidity.
  • Hierarchical — Parent and child names produce independent hashes, enabling hierarchical ownership in the registry.
  • Privacy — The hash is one-way; you cannot reverse a namehash back to the original name.
  • Collision-resistant — Keccak-256 provides strong collision resistance, making it infeasible to find two names with the same namehash.

Usage in Smart Contracts

When calling ENS registry functions like resolver(bytes32 node) or owner(bytes32 node), you pass the namehash as the node parameter. For example, to look up the resolver for vitalik.eth, you call resolver(namehash("vitalik.eth")) on the ENS Registry at 0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e.


Embed This Util

You can embed this util on your own site as a widget. Adding ?embed=1 to the URL loads a compact version with just the tool itself; no header, menu, or documentation. Paste this snippet into your HTML:


    

Copy snippet Adjust the height to taste.



Feedback

Help us improve this page by providing feedback, and include your name/email if you want us to reach back. Thank you in advance.


Share with