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

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

Returns a section of a [`Bytes.Bytes`](/docs/utilities/bytes/types#bytes) value given a start/end bytes offset.

## Imports

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

## Examples

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

Hex.slice('0x0123456789', 1, 4)
// @log: '0x234567'
```

## Definition

```ts
function slice(
  value: Hex,
  start?: number,
  end?: number,
  options?: slice.Options,
): Hex
```

## Parameters

### value

* **Type:** `Hex`

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

### start

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

The start offset (in bytes).

### end

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

The end offset (in bytes).

### options

* **Type:** `slice.Options`
* **Optional**

Options.

#### options.strict

* **Type:** `boolean`
* **Optional**

Asserts that the sliced value is the same size as the given start/end offsets.

## Return Type

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

`Hex`
