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

# Hex.validate

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

Checks if the given value is [`Hex.Hex`](/docs/utilities/hex/types#hex).

## Imports

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

## Examples

```ts twoslash
// @noErrors
import { Bytes, Hex } from 'viem/utils'

Hex.validate('0xdeadbeef')
// @log: true

Hex.validate(Bytes.from([1, 2, 3]))
// @log: false
```

## Definition

```ts
function validate(
  value: unknown,
  options?: validate.Options,
): value is Hex
```

## Parameters

### value

* **Type:** `unknown`

The value to check.

### options

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

Options.

#### options.strict

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

Checks if the [`Hex.Hex`](/docs/utilities/hex/types#hex) value contains invalid hexadecimal characters.

## Return Type

`true` if the value is a [`Hex.Hex`](/docs/utilities/hex/types#hex), `false` otherwise.

`value is Hex`
