# Bytes.fromBoolean

Encodes a boolean value into [`Bytes.Bytes`](/api/Bytes/types#bytes).

## Imports

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

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

## Examples

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

const data = Bytes.fromBoolean(true)
// @log: Uint8Array([1])
```

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

const data = Bytes.fromBoolean(true, { size: 32 })
// @log: Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])
```

## Definition

```ts
function fromBoolean(
  value: boolean,
  options?: fromBoolean.Options,
): Uint8Array
```

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

## Parameters

### value

* **Type:** `boolean`

Boolean value to encode.

### options

* **Type:** `fromBoolean.Options`
* **Optional**

Encoding options.

#### options.size

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

Size of the output bytes.

## Return Type

Encoded [`Bytes.Bytes`](/api/Bytes/types#bytes).

`Uint8Array`
