# length_bytes

Returns the length of a string in bytes.

```tql
length_bytes(x:string) -> int
```

## Description

The `length_bytes` function returns the byte length of the `x` string.

## Examples

### Get the byte length of a string

For ASCII strings, the byte length is the same as the number of characters:

```tql
from {x: "hello".length_bytes()}
```

```tql
{x: 5}
```

For Unicode, this may not be the case:

```tql
from {x: "👻".length_bytes()}
```

```tql
{x: 4}
```

## See Also

* [`length`](https://preview.docs.tenzir.com/375/375/reference/functions/length.md)
* [`length_chars`](https://preview.docs.tenzir.com/375/375/reference/functions/length_chars.md)
* [Manipulate strings](https://preview.docs.tenzir.com/375/375/guides/transformation/manipulate-strings.md)