# Mnemonic.toHdKey

Converts a mnemonic to a HD Key.

## Imports

:::code-group
```ts [Named]
import { Mnemonic } from 'ox'
```

```ts [Entrypoint]
import * as Mnemonic from 'ox/Mnemonic'
```
:::

## Examples

```ts twoslash
import { Mnemonic } from 'ox'

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
import { Mnemonic } from 'ox'

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
```

**Source:** [src/core/Mnemonic.ts](https://github.com/wevm/ox/blob/main/src/core/Mnemonic.ts#L232)

## 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`
