---
schema_version: "1"
id: ec494fb1745d86301b4ed3ca1fd13ad0bd9f5b77cb968c9c59710da0b9e6a9aa
title: "Handlebars Helper Function: encodeURIComponent"
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/handlebars/reference/hb_http_helpers/mcn-handlebars-reference-http-encodeuricomponent.md
canonical_url: https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-http-references/mcn-handlebars-reference-http-encodeuricomponent.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 2d7e5684c3dc17821bbd9502089cb5de56d905de9319d709c3a03d89ce8785b4
products:
  - Handlebars for Marketing Cloud Next
  - Marketing Cloud
---
# Handlebars Helper Function: encodeURIComponent

Encodes non-URL components of a string.

This function encodes only characters that follow a URL, such as a query string. To encode an entire string, use [encodeURI](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-http-references/mcn-handlebars-reference-http-encodeuri.md).

## Availability

This helper is available in the Winter ’27 release of Marketing Cloud Next.

## Syntax

```handlebars
{{encodeURIComponent stringToEncode}}
```

## Parameters

| Parameter        | Type   | Description                     |
| ---------------- | ------ | ------------------------------- |
| `stringToEncode` | String | Required. The string to encode. |

## Return Value

The function returns the URL-encoded string.

## Usage Example

This example encodes a string of text so that it's safe to include in a URL, converting all spaces and special characters.

```handlebars
{{encodeURIComponent
  "https://www.example.com/app?firstName=Cruz&lastName=De La Rosa&email=cdelarosa@example.com"
}}
```

The function returns this URL-encoded string:

```text
https://www.example.com/app?firstName=Cruz&lastName=De+La+Rosa&email=cdelarosa%40example.com
```

## See Also

- [encodeURI](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-http-references/mcn-handlebars-reference-http-encodeuri.md)
