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

# P256.fromMnemonic

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

Derives a valid P256 private key from a BIP-39 mnemonic.

This is equivalent to passing `Mnemonic.toSeed(mnemonic, { passphrase })` to [`P256.fromSeed`](/docs/utilities/p256/fromSeed).

## Imports

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

## Examples

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

const privateKey = P256.fromMnemonic(
  'test test test test test test test test test test test junk'
)
```

## Definition

```ts
function fromMnemonic<as>(
  mnemonic: string,
  options?: fromMnemonic.Options<as>,
): fromMnemonic.ReturnType<as>
```

## Parameters

### mnemonic

* **Type:** `string`

BIP-39 mnemonic phrase.

### options

* **Type:** `fromMnemonic.Options<as>`
* **Optional**

Options.

#### options.as

* **Type:** `"Bytes" | "Hex" | as`
* **Optional**

Format of the returned private key.

#### options.passphrase

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

Optional BIP-39 passphrase.

## Return Type

A valid P256 private key.

`fromMnemonic.ReturnType<as>`
