---
schema_version: "1"
id: d2e19b24c02cbfff00c388701a111f9d56f87cdef7a4fba2b72e49091ba6f747
title: "Handlebars Helper Function: trim"
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/handlebars/reference/string/mcn-handlebars-reference-string-trim.md
canonical_url: https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-string-references/mcn-handlebars-reference-string-trim.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: ba846901d22c8ba8df6bc0a224fb1d40c586722417796d220096deaa55aeeb45
products:
  - Handlebars for Marketing Cloud Next
  - Marketing Cloud
---
# Handlebars Helper Function: trim

Removes leading and trailing whitespace from a specified string value. The function can handle strings and attempts to convert other types to strings.

## Availability

This helper is available in the Winter ’26 release of Marketing Cloud Next.

## Syntax

```handlebars
{{trim subject}}
```

## Parameters

| Parameter | Type   | Description                                                                      |
| --------- | ------ | -------------------------------------------------------------------------------- |
| `subject` | String | Required. The string value to trim. Must be a string or convertible to a string. |

## Return Value

The function returns the input with all whitespace characters—including spaces, tabs, and newlines—removed from the beginning and end of the string. If the input is null, the function returns an empty string. If the input isn't a string, the function converts it to a string and trims the whitespace.
