---
schema_version: "1"
id: b962e80d1fe4479e1aba2fca950755afd714a2f3243e372a317c49ae32eaec25
title: "Handlebars Helper Function: substring"
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-substring.md
canonical_url: https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-string-references/mcn-handlebars-reference-string-substring.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 6463db4164aefa711985cfe371c1e3b6fa990d6cb3638b48f988cd4d5b12748f
products:
  - Handlebars for Marketing Cloud Next
  - Marketing Cloud
---
# Handlebars Helper Function: substring

Extracts a portion of a string starting from a specified position. The function can extract either the remainder of the string from the start position or a specific length of characters.

## Availability

This helper is available in the Winter ’26 release of Marketing Cloud Next.

## Syntax

```handlebars
{{substring subject start length}}
```

## Parameters

| Parameter | Type              | Description                                                                                                                                                    |
| --------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `subject` | String            | Required. The string to extract from. Must be a string or convertible to a string.                                                                             |
| `start`   | Integer or String | Required. The starting position for extraction. The first character is at position 1. Must be a number or convertible to a number, and must be greater than 0. |
| `length`  | Integer or String | The number of characters to extract. Must be a positive number or convertible to a positive number.                                                            |

## Return Value

The function returns a substring of the input string.

If you don’t specify the `length` parameter, the function returns the remainder of the string from the start position. If the start position is a number that’s greater than the number of characters in the string, it returns an empty string. If the value of the `length` parameter is larger than the number of characters remaining in the string or is less than 0, the function returns all characters from the start position to the end of the string. If the value of the `subject` parameter is null, the function returns an empty string.
