# length

> Documentation index: http://docs.tenzir.com/llms.txt

Retrieves the length of a list.

```tql
length(xs:list) -> int
```

## Description

The `length` function returns the number of elements in the list `xs`.

## Examples

### Get the length of a list

```tql
from {n: [1, 2, 3].length()}
```

```tql
{n: 3}
```

## See Also

* [`is_empty`](http://docs.tenzir.com/reference/functions/is_empty.md)
* [`length_bytes`](http://docs.tenzir.com/reference/functions/length_bytes.md)
* [`length_chars`](http://docs.tenzir.com/reference/functions/length_chars.md)
* [Shape lists](http://docs.tenzir.com/guides/transformation/shape-lists.md)