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

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

ViewHelper which can crop (shorten) a text. Whitespace within the `<f:format.crop>` element will be counted as characters.

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

**Table of contents**

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

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

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

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

```html
<f:format.crop maxCharacters="10">
This is some very long text
</f:format.crop>
```

**Output**

```text
This is...
```

The third word "some" does not fit in the 10 character limit, because respectWordBoundaries
is true by default.

### Custom suffix {#typo3-fluid-format-crop-custom-suffix}

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

```html
<f:format.crop maxCharacters="17" append="&nbsp;[more]">
This is some very long text
</f:format.crop>
```

**Output**

```text
This is some&nbsp;[more]
```

### Don't respect word boundaries {#typo3-fluid-format-crop-dont-respect-word-boundaries}

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

```html
<f:format.crop maxCharacters="10" respectWordBoundaries="false">
This is some very long text
</f:format.crop>
```

**Output**

```text
This is s...
```

### Don't respect HTML tags {#typo3-fluid-format-crop-dont-respect-html-tags}

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

```html
<f:format.crop maxCharacters="28" respectWordBoundaries="false" respectHtml="false">
This is some text with <strong>HTML</strong> tags
</f:format.crop>
```

**Output**

```text
This is some text with <stro
```

### Inline notation {#typo3-fluid-format-crop-inline-notation}

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

```html
{someLongText -> f:format.crop(maxCharacters: 10)}
```

**Output**

```text
someLongText cropped after 10 characters…
```

Depending on the value of `{someLongText}`.

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

-   **append**

    -   *Type:* string
    -   *Default:* '&hellip;'

    What to append, if truncation happened

-   **maxCharacters**

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

    Place where to truncate the string

-   **respectHtml**

    -   *Type:* bool
    -   *Default:* true

    If TRUE the cropped string will respect HTML tags and entities. Technically that means, that cropHTML() is called rather than crop()

-   **respectWordBoundaries**

    -   *Type:* bool
    -   *Default:* true

    If TRUE and division is in the middle of a word, the remains of that word is removed.
