# Bytes.from

Instantiates a [`Bytes.Bytes`](/api/Bytes/types#bytes) value from a `Uint8Array`, a hex string, or an array of unsigned 8-bit integers.

:::tip
To instantiate from a **Boolean**, **String**, or **Number**, use one of the following:

* `Bytes.fromBoolean`

* `Bytes.fromString`

* `Bytes.fromNumber`
:::

## Imports

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

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

## Examples

```ts twoslash
// @noErrors
import { Bytes } from 'ox'

const data = Bytes.from([255, 124, 5, 4])
// @log: Uint8Array([255, 124, 5, 4])

const data = Bytes.from('0xdeadbeef')
// @log: Uint8Array([222, 173, 190, 239])
```

## Definition

```ts
function from(
  value: Hex.Hex | Bytes | readonly number[],
): Bytes
```

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

## Parameters

### value

* **Type:** `Hex.Hex | Bytes | readonly number[]`

Value to convert.

## Return Type

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

`Bytes`
