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

# P256.getPublicKey

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

Computes the P256 ECDSA public key from a provided private key.

## Imports

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

## Examples

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

const publicKey = P256.getPublicKey({ privateKey: '0x...' })
```

## Definition

```ts
function getPublicKey<as>(
  options: getPublicKey.Options<as>,
): getPublicKey.ReturnType<as>
```

## Parameters

### options

* **Type:** `getPublicKey.Options<as>`

The options to compute the public key.

#### options.as

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

Format of the returned public key.

#### options.privateKey

* **Type:** `0x${string} | Uint8Array`

Private key to compute the public key from.

## Return Type

The computed public key.

`getPublicKey.ReturnType<as>`
