Intl
The Intl global object is a namespace that groups the constructors for language-sensitive formatting of numbers, dates, lists, and plural forms, plus locale-aware string comparison and text segmentation. It can’t be constructed and only holds static members. Each constructor takes a locale such as "de-DE" and returns an object that applies that locale’s conventions:
> new Intl.NumberFormat("de-DE").format(1234567.891)
'1.234.567,891'
> new Intl.NumberFormat("en-US").format(1234567.891)
'1,234,567.891'
Intl is defined in ECMA-402, the ECMAScript Internationalization API Specification, which is published every year next to ECMA-262. The locale data comes from the JavaScript engine, so the exact output can differ between engines and versions.
Most constructors take the same two arguments. The first, locales, is a language tag string, an Intl.Locale object, or an array of them in order of preference. The second is an options object whose properties depend on the constructor. Intl.Locale is the exception, because it parses a single tag.
When locales is omitted, the host’s default locale applies. A well-formed tag that the engine has no data for falls back to the next tag in the array, and then to the default locale. A malformed tag throws a RangeError.
The locale-aware methods on other built-ins use the same machinery. Number’s .toLocaleString() and String’s .localeCompare() accept the same locales and options arguments as their Intl counterparts.
Key Static Methods and Properties
| Member | Kind | Description |
|---|---|---|
Intl.NumberFormat |
Constructor | Creates formatters for numbers, currencies, percentages, units, and compact notation |
Intl.DateTimeFormat |
Constructor | Creates formatters for dates and times in a given locale and time zone |
Intl.Collator |
Constructor | Creates objects that compare strings in a locale’s sort order |
Intl.PluralRules |
Constructor | Creates objects that pick a plural category, such as "one" or "other", for a number |
Intl.RelativeTimeFormat |
Constructor | Creates formatters for phrases like “yesterday” or “in 3 hours” |
Intl.Locale |
Constructor | Creates objects that parse and represent a Unicode locale identifier |
Intl.ListFormat |
Constructor | Creates formatters that join items with a locale’s “and” or “or” (ES2021) |
Intl.DisplayNames |
Constructor | Creates objects that translate language, region, script, and currency codes into names (ES2021) |
Intl.Segmenter |
Constructor | Creates objects that split text into graphemes, words, or sentences (ES2022) |
Intl.DurationFormat |
Constructor | Creates formatters for durations such as “1 hour, 30 minutes” (ES2025) |
Intl.getCanonicalLocales() |
Static method | Returns an array of canonical locale tags |
Intl.supportedValuesOf() |
Static method | Returns the calendars, currencies, time zones, or units the engine supports (ES2022) |
The ES labels name the ECMAScript edition whose ECMA-402 companion added the member. Intl.DurationFormat is Baseline Newly available since 2025. The other members are Baseline Widely available.
Examples
An online shop shows the same cart total to customers in the United States and in Germany. The currency style picks the symbol, its position, and the separators:
> const total = 1234.5;
undefined
> const dollars = new Intl.NumberFormat("en-US", {
… style: "currency",
… currency: "USD",
… });
undefined
> const euros = new Intl.NumberFormat("de-DE", {
… style: "currency",
… currency: "EUR",
… });
undefined
> dollars.format(total)
'$1,234.50'
> euros.format(total)
'1.234,50 €'
A file browser lists report10.txt after report2.txt. Without a compare function, .toSorted() compares UTF-16 code units, while a collator with the numeric option compares digit runs as numbers:
> const files = ["report10.txt", "report2.txt", "report1.txt"];
undefined
> files.toSorted()
[ 'report1.txt', 'report10.txt', 'report2.txt' ]
> const collator = new Intl.Collator("en", { numeric: true });
undefined
> files.toSorted(collator.compare)
[ 'report1.txt', 'report2.txt', 'report10.txt' ]
A notification badge reads “1 new message” or “5 new messages”. Intl.PluralRules returns the category, and the code maps it to a word:
> const rules = new Intl.PluralRules("en-US");
undefined
> const words = { one: "message", other: "messages" };
undefined
> [1, 5].map((count) => `${count} new ${words[rules.select(count)]}`)
[ '1 new message', '5 new messages' ]
A post editor counts the characters a person sees. .length counts UTF-16 code units, while a grapheme segmenter counts what readers perceive as characters:
> const post = "Nice 👍🏽";
undefined
> post.length
9
> const segmenter = new Intl.Segmenter("en", { granularity: "grapheme" });
undefined
> [...segmenter.segment(post)].length
6
Common Gotchas
Formatted output often contains non-breaking spaces, so comparing it with a string typed with a regular space fails:
> const price = new Intl.NumberFormat("de-DE", {
… style: "currency",
… currency: "EUR",
… }).format(5);
undefined
> price === "5,00 €"
false
> price.includes("\u00a0")
true
Intl.DateTimeFormat uses the host’s time zone unless the timeZone option sets one, so the same instant can print as different calendar days:
> const launch = new Date("2026-03-14T23:30:00Z");
undefined
> const utc = new Intl.DateTimeFormat("en-US", { timeZone: "UTC" });
undefined
> const tokyo = new Intl.DateTimeFormat("en-US", { timeZone: "Asia/Tokyo" });
undefined
> utc.format(launch)
'3/14/2026'
> tokyo.format(launch)
'3/15/2026'
Have a question about this? Mentor AI can show you examples, compare related terms, and point you to tutorials.
By Leodanis Pozo Ramos • Updated Nov. 5, 2026