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

# Range ViewHelper `<f:range>` {#typo3fluid-fluid-range}

> [!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/Range.html) instead.

The RangeViewHelper returns an array containing a range of integers.

This ViewHelper mimicks PHP's `range()` function.

The following examples store the result in a variable because an array cannot
be outputted directly in a template.

## Examples {#examples}

### Increasing range {#increasing-range}

```php
<f:variable name="result"><f:range start="1" end="5" /></f:variable>

```

```text
{0: 1, 1: 2, 2: 3, 3: 4, 4: 5}
```

### Inline increasing range {#inline-increasing-range}

```php
<f:variable name="result" value="{f:range(start: 1, end: 5)}" />

```

```text
{0: 1, 1: 2, 2: 3, 3: 4, 4: 5}
```

### Decreasing range {#decreasing-range}

```php
<f:variable name="result" value="{f:range(start: 5, end: 0)}" />

```

```text
{0: 5, 1: 4, 2: 3, 3: 2, 4: 1, 5: 0}
```

### Increasing stepped range {#increasing-stepped-range}

```php
<f:variable name="result" value="{f:range(start: 1, end: 6, step: 2)" />

```

```text
{0: 1, 1: 3, 2: 5}
```

### Decreasing stepped range {#decreasing-stepped-range}

```php
<f:variable name="result" value="{f:range(start: 5, end: 1, step: 2)" />

```

```text
{0: 5, 1: 3, 2: 1}
```

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

**Arguments**

The following arguments are available for the range ViewHelper:

-   **end**

    -   *Type:* integer
    -   *Required:* true

    Last possible value of the sequence.

-   **start**

    -   *Type:* integer
    -   *Required:* true

    First value of the sequence.

-   **step**

    -   *Type:* integer
    -   *Default:* 1

    indicates by how much the produced sequence is progressed between values of the sequence.
