JavaScript Int.NumberFormat() constructor creates objects for Intl.NumberFormat(), which enables language-sensitive number formatting. This constructor can be called with or without a new keyword.
Syntax
new Intl.NumberFormat()
new Intl.NumberFormat(locales, options)
Parameters
- locales: A string with a BCP 47 language tag or an array of such strings.
- options: An object that can have properties like currencytDisplay, currencySign, signDisplay, useGrouping, localeMatcher, and many more.
Return Value
It returns a new Intl.NumberFormat object.
Example 1: How to useIntl.NumberFormat() Constructor
let number = 2334567.89;
let formatter = new Intl.NumberFormat('en-US').format(number);
console.log(formatter);
Output
2,334,567.89
Example 2: Using currency formatting
let currency1 = 67229.34;
let currencyFormatter1 = new Intl.NumberFormat('en-US',
{ style: 'currency', currency: 'USD' }).format(currency1);
console.log(currencyFormatter1);
let currency2 = 67229.34;
let currencyFormatter2 = new Intl.NumberFormat('en-GB',
{ style: 'currency', currency: 'GBP' }).format(currency2);
console.log(currencyFormatter2);
Output
$67,229.34
£67,229.34
Example 3: Using unit formatting
let number = 4000;
let number1 = new Intl.NumberFormat('en-US',
{ style: 'unit', unit: 'liter' }).format(number);
console.log(number1);
let number2 = new Intl.NumberFormat('en-US',
{ style: 'unit', unit: 'liter',unitDisplay: "long" }).format(number);
console.log(number2);
Output
4,000 L
4,000 liters
Example 4: Using Decimal and Percentage formatting
let number = 4000;
let number1 = Intl.NumberFormat('en-US',
{ style: 'decimal'}).format(number);
let number2 = Intl.NumberFormat('en-US',
{ style: 'percent'}).format(number);
console.log(number1);
console.log(number2);
Output
4,000
400,000%
Browser Compatibility
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |
That’s it!
Related posts
JavaScript Intl.DateTimeFormat.format() Method

Krunal Lathiya is a seasoned Computer Science expert with over eight years in the tech industry. He boasts deep knowledge in Data Science and Machine Learning. Versed in Python, JavaScript, PHP, R, and Golang. Skilled in frameworks like Angular and React and platforms such as Node.js. His expertise spans both front-end and back-end development. His proficiency in the Python language stands as a testament to his versatility and commitment to the craft.