> **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.

# Mnemonic.toHdKey

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

Converts a mnemonic to a HD Key.

## Imports

```ts
import { Mnemonic } from 'viem/utils'
```

## Examples

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

const mnemonic = Mnemonic.random(Mnemonic.english)
const hdKey = Mnemonic.toHdKey(mnemonic)
```

### Path Derivation

You can derive a HD Key at a specific path using `derive`:

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

const mnemonic = Mnemonic.random(Mnemonic.english)
const hdKey = Mnemonic.toHdKey(mnemonic).derive(
  Mnemonic.path({ index: 1 })
)
```

## Definition

```ts
function toHdKey(
  mnemonic: string,
  options?: toHdKey.Options,
): HdKey.HdKey
```

## Parameters

### mnemonic

* **Type:** `string`

The mnemonic to convert.

### options

* **Type:** `toHdKey.Options`
* **Optional**

Conversion options.

#### options.passphrase

* **Type:** `string`
* **Optional**

An optional passphrase for additional protection to the seed.

## Return Type

The HD Key.

`HdKey.HdKey`
