---
title: "Format.padding ViewHelper <f:format.padding>"
manual: "Fluid ViewHelper Reference"
version: "main"
permalink: "https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-format-padding@main"
source: "Global/Format/Padding.rst"
rendered: "2026-09-26T06:08:28+00:00"
---

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

ViewHelper to format a string to specific lengths, by using PHPs `str_pad` function.

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

**Table of contents**

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

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

### Defaults {#typo3-fluid-format-padding-defaults}

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

```html
<f:format.padding padLength="10">TYPO3</f:format.padding>
```

**Output**

```text
TYPO3␠␠␠␠␠
```

### Specify padding string {#typo3-fluid-format-padding-specify-padding-string}

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

```html
<f:format.padding padLength="10" padString="-=">TYPO3</f:format.padding>
```

**Output**

```text
TYPO3-=-=-
```

### Specify padding type {#typo3-fluid-format-padding-specify-padding-type}

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

```html
<f:format.padding padLength="10" padString="-" padType="both">TYPO3</f:format.padding>
```

**Output**

```text
--TYPO3---
```

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

-   **padLength**

    -   *Type:* int
    -   *Required:* true

    Length of the resulting string. If the value of pad_length is negative or less than the length of the input string, no padding takes place.

-   **padString**

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

    The padding string

-   **padType**

    -   *Type:* string
    -   *Default:* 'right'

    Append the padding at this site (Possible values: right,left,both. Default: right)

-   **value**

    -   *Type:* string

    string to format
