Runtime verified Test scripts included

Formats a number as one numeric type, for example decimal or percent.

Syntax

{{formatNumber number formatType [cultureCode]}}

Returns string.

Parameters

Name Type Required Description
number number Yes Input number.
formatType string Yes Number format type: C, D, E, F, G, N, P, R, or X.
cultureCode string No Locale code. Defaults to en_US.

Example

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

  • {{formatNumber 1234.567 "C2"}} renders $1,234.57, as documented.
  • {{formatNumber 1234.567 "F"}} renders 1234.57, as documented.
Show Next test script
<!-- Marketing Cloud Next test script for the formatNumber 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=[$1,234.57] got=[{{formatNumber 1234.567 "C2"}}]</p>
<p>c2 expect=[1234.57] got=[{{formatNumber 1234.567 "F"}}]</p>

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