Handlebars stringToHex
Handlebars stringToHex: returns the hexadecimal representation of the encoded characters of a string.
Next
Runtime verified
Test scripts included
Returns the hexadecimal representation of the encoded characters of a string.
Syntax
{{stringToHex subject [...options]}}
Returns string.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
subject |
string | Yes | String to encode as hex. |
options |
any | No, repeatable | Named argument charSet: UTF-8 (default) or UTF-16. |
Example
Tested in a Marketing Cloud Next email on 2026-11-22:
{{stringToHex "abc"}}renders616263, as documented.{{stringToHex "abc" charSet="UTF-16"}}renders610062006300.
Show Next test script
Marketing Cloud Next
Works as documented
Every tested call rendered the documented result. Tested 2026-11-22 by rendering in a Marketing Cloud Next email.
See also
- AMPscript
StringToHex— does a similar job in AMPscript, with a different call shape - Official reference