---
title: "Length ViewHelper <f:length>"
manual: "Fluid Explained"
version: "main"
permalink: "https://docs.typo3.org/permalink/fluid:typo3fluid-fluid-length"
source: "ViewHelpers/Fluid/Length.rst"
rendered: "2026-09-26T08:24:58+00:00"
---

# Length ViewHelper `<f:length>` {#typo3fluid-fluid-length}

> [!NOTE]
> This reference is part of the documentation of Fluid Standalone.
> If you are working with Fluid in TYPO3 CMS, please refer to
> [TYPO3's ViewHelper reference](https://docs.typo3.org/other/typo3/view-helper-reference/14.3/en-us/Global/Length.html) instead.

The LengthViewHelper returns the length of a given string.
Setting the character encoding is optional.

## Examples {#examples}

### Simple example {#simple-example}

```php
<f:length value="Hello, World!" />

```

Output:

```php
13

```

### Example with encoding {#example-with-encoding}

```php
<f:length value="Hello, World!" encoding="UTF-8" />

```

Output:

```php
13

```

For supported character encodings see [https://www.php.net/manual/en/mbstring.supported-encodings.php](https://www.php.net/manual/en/mbstring.supported-encodings.php)

### Inline notation {#inline-notation}

```php
{f:length(value: 'Hello, World!')}

```

Output:

```php
13
```

Go to the source code of this ViewHelper: [LengthViewHelper.php (GitHub)](https://github.com/TYPO3/Fluid/blob/main/src/ViewHelpers/LengthViewHelper.php).

**Arguments**

The following arguments are available for the length ViewHelper:

-   **encoding**

    -   *Type:* string

    Character encoding

-   **value**

    -   *Type:* mixed

    An string
