# 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](/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](/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-http-references/mcn-handlebars-reference-http-encodeuri.md)
