# Hex.toBoolean

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

## Imports

:::code-group
```ts [Named]
import { Hex } from 'ox'
```

```ts [Entrypoint]
import * as Hex from 'ox/Hex'
```
:::

## Examples

```ts twoslash
import { Hex } from 'ox'

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

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

## Definition

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

**Source:** [src/core/Hex.ts](https://github.com/wevm/ox/blob/main/src/core/Hex.ts#L1003)

## Parameters

### hex

* **Type:** `Hex`

The [`Hex.Hex`](/api/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`
