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

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

Decodes a [`Hex.Hex`](/docs/utilities/hex/types#hex) value into a boolean.

## Imports

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

## Examples

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

Hex.toBoolean('0x01')
// @log: true

Hex.toBoolean(
  '0x0000000000000000000000000000000000000000000000000000000000000001',
  { size: 32 }
)
// @log: true
```

## Definition

```ts
function toBoolean(
  hex: Hex,
  options?: toBoolean.Options,
): boolean
```

## Parameters

### hex

* **Type:** `Hex`

The [`Hex.Hex`](/docs/utilities/hex/types#hex) value to decode.

### options

* **Type:** `toBoolean.Options`
* **Optional**

Options.

#### options.size

* **Type:** `number`
* **Optional**

Size (in bytes) of the hex value.

## Return Type

The decoded boolean.

`boolean`
