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

# Bytes.slice

:::info
`Bytes.slice` is a re-export of ox's [`Bytes.slice`](https://oxlib.sh/api/Bytes/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 { Bytes } from 'viem/utils'
```

## Examples

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

Bytes.slice(Bytes.from([1, 2, 3, 4, 5, 6, 7, 8, 9]), 1, 4)
// @log: Uint8Array([2, 3, 4])
```

## Definition

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

## Parameters

### value

* **Type:** `Bytes`

The [`Bytes.Bytes`](/docs/utilities/bytes/types#bytes) value.

### start

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

Start offset.

### end

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

End offset.

### options

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

Slice options.

#### options.strict

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

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

## Return Type

Sliced [`Bytes.Bytes`](/docs/utilities/bytes/types#bytes) value.

`Bytes`
