# Hex.fromBytes

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

## Imports

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

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

## Examples

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

Hex.fromBytes(
  Bytes.from([
    72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33
  ])
)
// @log: '0x48656c6c6f20576f726c6421'
```

## Definition

```ts
function fromBytes(
  value: Uint8Array,
  options?: fromBytes.Options,
): Hex
```

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

## Parameters

### value

* **Type:** `Uint8Array`

The [`Bytes.Bytes`](/api/Bytes/types#bytes) value to encode.

### options

* **Type:** `fromBytes.Options`
* **Optional**

Options.

#### options.size

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

The size (in bytes) of the output hex value.

## Return Type

The encoded [`Hex.Hex`](/api/Hex/types#hex) value.

`Hex`
