Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / JavaScript

Intl.NumberFormat — locale-aware number formatting

Intl.NumberFormat converts numbers into text using a locale and formatting options. It controls details such as digit grouping and decimal places; format returns a function bound to a particular formatter.

Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support

Syntax

const formatter = new Intl.NumberFormat(locales, options);
formatter.format(value);

Intl.NumberFormat creates a number formatter using locales and options. It belongs to ECMA-402, not the DOM API. Formatting produces display text, not a new numeric value or a parser for localized numbers.

Intl.NumberFormat.prototype.format is an accessor property: reading it from an instance returns a function bound to that instance. Thus, const format = formatter.format lets you later call format(value) without losing the settings. You can reuse the same formatter for multiple values.

minimumFractionDigits sets the minimum and maximumFractionDigits the maximum number of digits after the decimal separator. When those limits apply, setting both to 2 displays two digits after the decimal separator with the default trailingZeroDisplay: "auto", rounding when necessary. With trailingZeroDisplay: "stripIfInteger", the fractional zeros are omitted if the rounded result is an integer. With the default roundingPriority: "auto", specifying maximumSignificantDigits makes the formatter ignore both fraction-digit limits. useGrouping: false disables grouping. The currency style requires a currency option but does not convert exchange rates.

The example explicitly selects en-US and latn digits. Locale availability and formatting details can depend on the implementation and its locale data. Check the result in the target browser; availability in Node 24 does not prove browser support.

Examples

const formatter = new Intl.NumberFormat("en-US", {
  numberingSystem: "latn",
  useGrouping: false,
  minimumFractionDigits: 2,
  maximumFractionDigits: 2
});
const format = formatter.format;
console.log(format(1234.5));

Result

1234.50

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources