value | number | string | undefined | undefined | The number to format: a number from script, or a numeric string such as 1234.5 in markup. |
type | FormatNumberType | decimal | decimal, currency (with currency), percent (0.25 reads "25%"), unit (with unit) or bytes (1536 reads "1.5 kB"). |
notation | FormatNumberNotation | standard | standard, compact ("1.2K"), scientific ("1.2E3") or engineering. |
compact-display | FormatNumberCompactDisplay | short | Length of the compact suffix: short ("1.2K") or long ("1.2 thousand"). |
currency | string | USD | ISO 4217 currency code for type="currency", such as EUR or JPY; its own decimals are used. |
currency-display | FormatNumberCurrencyDisplay | symbol | How the currency is named: symbol ("$"), narrowSymbol, code ("USD") or name ("US dollars"). |
currency-sign | FormatNumberCurrencySign | standard | accounting writes a negative amount in parentheses where the locale does. |
unit | string | — | For type="unit", a unit Intl.NumberFormat knows (kilometer-per-hour, celsius, liter); for type="bytes", byte (default) or bit. |
unit-display | FormatNumberUnitDisplay | short | How the unit is named: short ("5 km/h"), narrow ("5km/h") or long ("5 kilometers per hour"). |
sign-display | FormatNumberSignDisplay | auto | When to show the sign: auto, always, exceptZero (a "+" on gains, none on zero), negative or never. |
no-grouping | boolean | false | Drop the thousands separators, for years, IDs and codes. |
binary | boolean | false | For type="bytes", steps of 1024 instead of 1000, still labelled kB, MB… as Windows does. |
minimum-integer-digits | number | undefined | undefined | Pad the integer part with leading zeros to this many digits (1–21). |
minimum-fraction-digits | number | undefined | undefined | Fewest decimals to show (0–100); pads with zeros. |
maximum-fraction-digits | number | undefined | undefined | Most decimals to show (0–100); rounds the rest. |
minimum-significant-digits | number | undefined | undefined | Fewest significant digits (1–21); takes precedence over the fraction digits. |
maximum-significant-digits | number | undefined | undefined | Most significant digits (1–21); takes precedence over the fraction digits. |
locale | string | — | BCP 47 locale of the number. Empty uses the nearest lang attribute, then the browser's language. |