---
title: "Round ViewHelper <f:round>"
manual: "Fluid Explained"
version: "main"
permalink: "https://docs.typo3.org/permalink/fluid:typo3fluid-fluid-round"
source: "ViewHelpers/Fluid/Round.rst"
rendered: "2026-10-08T14:12:40+00:00"
---

# Round ViewHelper `<f:round>` {#typo3fluid-fluid-round}

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

The RoundViewHelper rounds a float value with the specified precision and rounding mode.
The ViewHelper mimics PHP's `round()` function.

| rounding modes | PHP < 8.4 | PHP >= 8.4 |
| --- | --- | --- |
| HalfAwayFromZero | Yes | Yes |
| HalfTowardsZero | Yes | Yes |
| HalfEven | Yes | Yes |
| HalfOdd | Yes | Yes |
| TowardsZero | No | Yes |
| AwayFromZero | No | Yes |
| NegativeInfinity | No | Yes |
| PositiveInfinity | No | Yes |

## Examples {#examples}

### Round with default precision {#round-with-default-precision}

```php
<f:round value="123.456" />

```

```text
123.46
```

### Round with specific precision {#round-with-specific-precision}

```php
<f:round value="123.456" precision="1" />

```

```text
123.5
```

### Round with specific precision and rounding mode {#round-with-specific-precision-and-rounding-mode}

```php
<f:round value="123.456" precision="1" roundingMode="HalfAwayFromZero" />

```

```text
123.5
```

### Tag content as value {#tag-content-as-value}

```php
<f:round precision="1">123.456</f:round>

```

```text
123.5
```

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

**Arguments**

The following arguments are available for the round ViewHelper:

-   **precision**

    -   *Type:* int
    -   *Default:* 2

    Rounding precision

-   **roundingMode**

    -   *Type:* string
    -   *Default:* 'HalfAwayFromZero'

    Rounding mode

-   **value**

    -   *Type:* float

    The number that should be rounded
