Skip to main content

Try it Live

Run ENS examples in the interactive playground

ENS Encoding

Cryptographic operations for ENS names implementing EIP-137 name hashing.

Functions

namehash(name)

Compute ENS namehash for a given name. Algorithm: namehash(name) = keccak256(namehash(parent) ‖ labelhash(label)) Empty string has hash of 32 zero bytes.

labelhash(label)

Compute ENS labelhash for a single label. Algorithm: labelhash(label) = keccak256(label)

Algorithm Details

Namehash Recursion

Process labels in reverse order (right-to-left).

Bundle Size

Factory pattern enables tree-shaking:
  • Functional API: ~15KB (includes keccak256)
  • Factory API with custom crypto: Depends on your keccak256 implementation

See Also