---
title: "length function in Strata | Oplema"
description: "Count the characters in text, such as 5 for hello, including any spaces. Write it as length(string) in a Strata Formula or Filter."
url: "https://oplema.com/docs/strata/functions/length"
updated: "2026-11-04"
---

# length

Count the characters in text. For a list, count its items.

Also available as char\_length, character\_length, len.

## Try an expression

In [Formula](https://oplema.com/docs/strata/prep/formula), enter the expression and set Output type to **BIGINT**.

### Expression

```
length('Hello🦆')
```

### Result

```
6
```

To use your own data, replace the example values with column names. Keep format strings and other options as written.

Try it live in Formula

Result
| id | result |
| --- | --- |
| 1 | 6 |

## Arguments and types

```
length(string)
```

**string**

Text

**bit**

Bits

**list**

List

Supported signatures (3)

```
length(bit: BIT) → BIGINT
length(list: ANY[]) → BIGINT
length(string: VARCHAR) → BIGINT
```

The result type can depend on the input types. See DuckDB for the full argument rules.

## Things to know

If the first argument is missing, the result is NULL.

## Related functions

[damerau\_levenshtein

Count the edits needed to turn one string into another, like levenshtein, but swapping two neighboring characters counts as one edit. Uppercase and lowercase letters count as different.

](https://oplema.com/docs/strata/functions/damerau-levenshtein)[levenshtein

Count the fewest character insertions, deletions and substitutions needed to turn one string into another. Uppercase and lowercase letters count as different.

](https://oplema.com/docs/strata/functions/levenshtein)[bit\_length

Number of bits in a string.

](https://oplema.com/docs/strata/functions/bit-length)[hamming

Calculate the Hamming distance between two strings: the number of positions where their characters differ. Both strings must have the same length, and uppercase and lowercase letters count as different.

](https://oplema.com/docs/strata/functions/hamming)

[Browse text](https://oplema.com/docs/strata/functions#text) [DuckDB documentation](https://duckdb.org/docs/current/sql/functions/text.html#lengthstring)

Function metadata from DuckDB, used under the [MIT license](https://github.com/duckdb/duckdb/blob/v1.5.4/LICENSE).
