JavaScript Intl.NumberFormat Object
Intl.NumberFormat formats numbers for a language and region, including currencies, percentages, units and compact forms like 1.2K.
Description
Intl.NumberFormat creates a formatter for numbers that uses the right digits, decimal separator and grouping for a locale. The style option can be 'decimal', 'currency' (with a currency code such as 'EUR'), 'percent' or 'unit' (with a unit such as 'kilometer-per-hour'). notation: 'compact' gives short forms such as "1.2K", and minimumFractionDigits and maximumFractionDigits control rounding.
Reuse one formatter for many numbers rather than calling toLocaleString() repeatedly with the same options.
formatToParts() returns the formatted number split into labelled pieces, such as the integer, decimal separator, fraction and currency symbol, so you can style them separately. formatRange() formats ranges like "$3 – $5" correctly for the locale. The signDisplay option controls whether plus signs appear, and roundingMode and roundingIncrement give fine control over rounding, such as rounding prices to the nearest 5 cents.
Creating
new Intl.NumberFormat(locales, options)Example
Browser Support
The following information will show you the current browser support for the Intl.NumberFormat object. Hover over a browser icon to see the version that first introduced support for this object.
Desktop





Tablets & Mobile





