---
title: "Format.padding ViewHelper <f:format.padding>"
manual: "Fluid ViewHelper Reference"
version: "13.4"
permalink: "https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-format-padding@13.4"
source: "Global/Format/Padding.rst"
modified: "2026-09-17T09:07:45+00:00"
---

# Format.padding ViewHelper `<f: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@13.4)
-   [Arguments of the <f:format.padding> ViewHelper](https://docs.typo3.org/permalink/t3viewhelper:arguments-of-the-f-format-padding-viewhelper@13.4)

## Examples

### 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

**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

**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

-   **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
