---
title: bytes() function
description: bytes() converts a string value to a bytes type.
url: https://docs.influxdata.com/flux/v0/stdlib/universe/bytes/
estimated_tokens: 422
product: Flux
version: v0
---

# bytes() function

-   Flux 0.40.0+
-   View InfluxDB support

`bytes()` converts a string value to a bytes type.

##### Function type signature

```js
(v: A) => bytes
```

For more information, see [Function type signatures](/flux/v0/function-type-signatures/).

## Parameters

### v

(Required) Value to convert.

## Examples

### Convert a string to bytes

```js
bytes(v: "Example string")// Returns 0x4578616d706c6520737472696e67

```

#### Related

-   [Work with bytes types](/flux/v0/data-types/basic/bytes/)

[type-conversions](/flux/v0/tags/type-conversions/)
