---
title: "strPad"
manual: "TypoScript Explained"
version: "13.4"
permalink: "https://docs.typo3.org/permalink/t3tsref:strpad@13.4"
source: "Functions/Strpad.rst"
rendered: "2026-09-18T10:44:33+00:00"
---

# strPad {#strpad}

This property returns the input value padded to a certain length. The
padding is added on the left side, the right side or on both sides.
`strPad` uses the PHP function [str_pad()](https://www.php.net/str-pad)
for the operation.

-   [Properties](https://docs.typo3.org/permalink/t3tsref:properties@13.4)
-   [Examples](https://docs.typo3.org/permalink/t3tsref:examples@13.4)

## Properties {#strpad-properties}

### length {#strpad-length}

-   **length**

    -   *Type:* [integer](https://docs.typo3.org/permalink/t3tsref:data-type-integer@13.4) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@13.4)
    -   *Default:* 0

    The length of the output string. If the value is negative, less
    than, or equal to the length of the input value, no padding
    takes place.

### padWith {#strpad-padwith}

-   **padWith**

    -   *Type:* [string](https://docs.typo3.org/permalink/t3tsref:data-type-string@13.4) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@13.4)
    -   *Default:* (space character)

    The character(s) to pad with. The value of `padWith` may be
    truncated, if the required number of padding characters cannot
    be evenly divided by the length of the value of `padWith`. Note
    that leading and trailing spaces of `padWith` are stripped! If
    you want to pad with spaces, omit this option.

### type {#strpad-type}

-   **type**

    -   *Type:* *(list of keywords)* / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@13.4)
    -   *Default:* right

    The side(s) of the input value, on which the padding should be
    added. Possible keywords are "left", "right" or "both".

## Examples {#strpad-examples}

**EXT:site_package/Configuration/TypoScript/setup.typoscript**

```typoscript
10 = TEXT
# The input value is 34 signs long.
10.value = TYPO3 - inspiring people to share.
10.value.strPad {
  length = 37
  padWith = =
  type = both
}

```

This results in "=TYPO3 - inspiring people to share.==".
