---
title: "Format.bytes ViewHelper <f:format.bytes>"
manual: "Fluid ViewHelper Reference"
version: "main"
permalink: "https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-format-bytes@main"
source: "Global/Format/Bytes.rst"
rendered: "2026-09-29T15:44:59+00:00"
---

# Format.bytes ViewHelper `<f:format.bytes>` {#typo3-fluid-format-bytes}

ViewHelper which formats an integer (byte count) into specific human-readable output.

Go to the source code of this ViewHelper: [Format\\BytesViewHelper.php (GitHub)](https://github.com/TYPO3/typo3/blob/main/typo3/sysext/fluid/Classes/ViewHelpers/Format/BytesViewHelper.php).

**Table of contents**

-   [Examples](https://docs.typo3.org/permalink/t3viewhelper:examples@main)
-   [Arguments of the <f:format.bytes> ViewHelper](https://docs.typo3.org/permalink/t3viewhelper:arguments-of-the-f-format-bytes-viewhelper@main)

## Examples {#typo3-fluid-format-byte-example}

### Simple {#typo3-fluid-format-bytes-simple}

**packages/my_extension/Resources/Private/Templates/Content/Text.fluid.html**

```html
{fileSize -> f:format.bytes()}
```

**Output**

```text
123 KB
```

Depending on the value of `{fileSize}`.

### With arguments {#typo3-fluid-format-bytes-with-arguments}

**packages/my_extension/Resources/Private/Templates/Content/Text.fluid.html**

```html
{fileSize -> f:format.bytes(decimals: 2, decimalSeparator: '.', thousandsSeparator: ',')}
```

**Output**

```text
1,023.00 B
```

Depending on the value of `{fileSize}`.

You may provide an own set of units, like this: `B,KB,MB,GB,TB,PB,EB,ZB,YB`.

### Custom units {#typo3-fluid-format-bytes-custom-units}

**packages/my_extension/Resources/Private/Templates/Content/Text.fluid.html**

```html
{fileSize -> f:format.bytes(units: '{f:translate(\'viewhelper.format.bytes.units\', \'fluid\')}')}
```

**Output**

```text
123 KB
```

Depending on the value of `{fileSize}`.

## Arguments of the `<f:format.bytes>` ViewHelper {#typo3-fluid-format-bytes-arguments}

-   **decimalSeparator**

    -   *Type:* string
    -   *Default:* '.'

    The decimal point character

-   **decimals**

    -   *Type:* int
    -   *Default:* 0

    The number of digits after the decimal point

-   **thousandsSeparator**

    -   *Type:* string
    -   *Default:* ','

    The character for grouping the thousand digits

-   **units**

    -   *Type:* string

    comma separated list of available units, default is LocalizationUtility::translate('viewhelper.format.bytes.units', 'fluid')

-   **value**

    -   *Type:* int|float|string

    The incoming data to convert, or NULL if VH children should be used
