Runtime verified Test scripts included

URL-encodes the part of a string that comes after the address, such as a query string. For a whole string, use encodeURI.

Syntax

{{encodeURIComponent text}}

Returns string.

Parameters

Name Type Required Description
text string Yes The text to encode.

Example

Tested in a Marketing Cloud Next email on 2026-11-22:

  • {{encodeURIComponent "a b/c"}} renders a%20b%2Fc.
Show Next test script
<!-- Marketing Cloud Next test script for the encodeURIComponent helper. Paste it into the HTML component of a
     Next email and open the preview. Each line prints the result Next gave when the call
     was rendered on its own (expect) next to the result of this run (got).
     Assembled from single-call test emails (dates on the page); it has not been
     run as one email. Calls that make Next fail are listed separately. -->
<p>c1 expect=[a%20b%2Fc] got=[{{encodeURIComponent "a b/c"}}]</p>

Marketing Cloud Next

Works as documented

{{encodeURIComponent "a b/c"}} renders a%20b%2Fc: both the space and the slash are encoded. Tested 2026-11-22 by rendering in a Marketing Cloud Next email.

See also