---
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: 134
product: Flux
version: v0
publisher: InfluxData
canonical: https://docs.influxdata.com/flux/v0/stdlib/universe/bytes/
date: '2024-04-08T16:01:02-06:00'
lastmod: '2024-04-08T16:01:02-06:00'
---

* Flux 0.40.0+

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

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

```

#### Related

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

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