> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://v3.viem.sh/api/mcp` to find what you need.

# Ens

:::info
`Ens` is a re-export of ox's [`Ens`](https://oxlib.sh/api/Ens). Refer to the ox documentation for the full reference.
:::

Utility functions for working with ENS names.

## Examples

Below are some examples demonstrating common usages of the `Ens` module:

* [Normalizing ENS Names](#normalizing-ens-names)

* [Namehashing ENS Names](#namehashing-ens-names)

### Normalizing ENS Names

ENS names can be normalized using [`Ens.normalize`](/docs/utilities/ens/normalize):

```ts twoslash
// @noErrors
import { Ens } from 'viem/utils'

const name = Ens.normalize('w𝝣vm.eth')
// @log: 'wξvm.eth'
```

### Namehashing ENS Names

ENS names can be namehashed using [`Ens.namehash`](/docs/utilities/ens/namehash):

```ts twoslash
// @noErrors
import { Ens } from 'viem/utils'

const name = Ens.namehash('alice.eth')
// @log: '0x787192fc5378cc32aa956ddfdedbf26b24e8d78e40109add0eea2c1a012c3dec'
```

## Functions

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`Ens.labelhash`](/docs/utilities/ens/labelhash) | Hashes ENS label. |
| [`Ens.namehash`](/docs/utilities/ens/namehash) | Hashes ENS name. |
| [`Ens.normalize`](/docs/utilities/ens/normalize) | Normalizes ENS name according to [ENSIP-15](https://github.com/ensdomains/docs/blob/9edf9443de4333a0ea7ec658a870672d5d180d53/ens-improvement-proposals/ensip-15-normalization-standard.md). |
| [`Ens.toCoinType`](/docs/utilities/ens/toCoinType) | Converts a chain ID to an ENSIP-9 compliant coin type. |

## Errors

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`Ens.InvalidChainIdError`](/docs/utilities/ens/errors#ensinvalidchainiderror) | Thrown when an ENS chain ID is invalid. |
