Intl.NumberFormat

Intl.NumberFormat.prototype.format

Formats a number according to the locale and formatting options of this Intl.NumberFormat object

Syntax

JavaScript
numberFormat.format(number)

Parameters

ParameterTypeDescription
numbernumber | bigintThe number to format

Return Value

A string containing the formatted number

Examples

Basic Usage
const fmt = new Intl.NumberFormat('de-DE')
console.log(fmt.format(1234567.89)) // '1.234.567,89'
Practical Example
const percent = new Intl.NumberFormat('en-US', { style: 'percent' })
console.log(percent.format(0.75)) // '75%'
Advanced Usage
const bytes = new Intl.NumberFormat('en', {
  style: 'unit',
  unit: 'megabyte',
  unitDisplay: 'narrow'
})
console.log(bytes.format(512)) // '512MB'

Understanding Intl.NumberFormat.prototype.format

The Intl.NumberFormat.prototype.format method in JavaScript formats a number according to the locale and formatting options of this Intl.NumberFormat object. It belongs to the Intl.NumberFormat object and is one of the most widely used methods for working with intl.numberformat values in modern JavaScript and TypeScript applications.

The method signature is numberFormat.format(number). It accepts 1 parameter: number. When called, it returns a string containing the formatted number. Understanding when and how to use format() helps you write more expressive, readable code.

Common use cases for Intl.NumberFormat.prototype.format include data transformation, input validation, API response processing, and building reusable utility functions. It works well alongside related methods like intl-numberformat, intl-numberformat-formattoparts, intl-numberformat-formatrange, enabling you to chain operations together for complex data manipulation pipelines.

Browser support for Intl.NumberFormat.prototype.format is excellent across all modern browsers including Chrome, Firefox, Safari, and Edge. It is also fully supported in Node.js and Deno. For older environments, transpilation with Babel or a polyfill may be needed.

Browser Compatibility

Supported in all modern browsers (Chrome, Firefox, Safari, Edge) and Node.js. Part of the ECMAScript standard.

Related Methods

More Intl.NumberFormat Methods

Other methods in the Intl.NumberFormat object

Related Tools

More Intl.NumberFormat Methods

Explore JavaScript Methods

Browse our complete reference of 410 JavaScript methods with syntax, examples, and explanations.