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

# PublicKey.validate

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

Validates a [`PublicKey.PublicKey`](/docs/utilities/publickey/types#publickey). Returns `true` if valid, `false` otherwise.

## Imports

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

## Examples

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

const valid = PublicKey.validate({
  prefix: 4,
  y: '0x6e1c1f59ee1cf25b75a8d57b3c89e7e6b3b1da823df8b3b89497f30c1f000000'
})
// @log: false
```

## Definition

```ts
function validate(
  publicKey: ExactPartial<PublicKey>,
  options?: validate.Options,
): boolean
```

## Parameters

### publicKey

* **Type:** `ExactPartial<PublicKey>`

The public key object to assert.

### options

* **Type:** `validate.Options`
* **Optional**

#### options.compressed

* **Type:** `boolean`
* **Optional**

Whether or not the public key should be compressed.

## Return Type

`boolean`
