Intl is a built-in JavaScript object for internationalization: formatting dates, numbers, lists and relative times, comparing strings, naming languages and regions, and working with locale tags. You do not import it. You call constructors such as new Intl.NumberFormat() or static helpers such as Intl.getCanonicalLocales().
Each formatter takes a locale (for example "en-US" or "de-DE") and options, then turns data into text that matches that language and region. That is better than building strings by hand with commas and currency symbols.
This page explains the idea. The Intl Methods index links the full guides for every helper and constructor in this series.
Intl is not a constructor.
You never write new Intl(). Intl is a namespace object, like Math. You use its constructors and static methods, such as new Intl.DateTimeFormat() and Intl.getCanonicalLocales().
Syntax
JavaScript Syntax
Create a formatter with a locale, then call format:
JavaScript
const price = new Intl.NumberFormat("en-US", {
style: "currency",
currency: "USD"
});
console.log(price.format(19.99));
const d = new Date(Date.UTC(2024, 5, 15, 12, 0, 0));
console.log(new Intl.DateTimeFormat("en-US", { timeZone: "UTC" }).format(d));
Reference
Core Ideas
Ideas every Intl tutorial in this series builds on:
Idea
Example
Remember
Intl
Intl.NumberFormat
The built-in namespace for locale APIs. You do not create it
Locale tag
"en-US" or "de-DE"
A BCP 47 language tag that picks language and region
Formatter
new Intl.DateTimeFormat()
An object that turns data into locale text
options
{ style: "currency" }
Settings that change how format() looks
Canonical tag
Intl.getCanonicalLocales()
Normalized locale strings
Plural category
PluralRules.select(1)
Names like one or other used to pick message text
Feature guard
typeof Intl.Segmenter
Check before using newer Intl APIs
Compare
Hand-built Strings vs Intl
You can build labels yourself, but Intl knows locale rules:
Task
Hand-built idea
Intl way
Money
"$" + n
new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" })
Date
pad month/day yourself
new Intl.DateTimeFormat("en-US", { timeZone: "UTC" })
List
a + ", " + b
new Intl.ListFormat("en").format([a, b])
Sort names
a < b
new Intl.Collator("en").compare
Relative time
custom "days ago"
new Intl.RelativeTimeFormat("en").format(-3, "day")
Clean tags
manual lower-casing
Intl.getCanonicalLocales(tags)
Use Intl whenever the output must follow a language or region. Keep hand-built strings for fixed technical labels that never change by locale.
Behavior
How Intl Works
Pick a locale
Pass a tag such as "en-US" or a list of tags. The engine chooses the best available locale.
Create a formatter
Most tools are constructors: new Intl.NumberFormat(), new Intl.DateTimeFormat(), and so on.
Call format (or compare)
Feed data into format, compare, select or of depending on the API.
Reuse the object
Build one formatter and call it many times. That keeps code clear and avoids recreating options.
Guard new APIs
Some members are newer (Segmenter, DurationFormat, supportedValuesOf). Check typeof before using them.
Practice
Real-Life Uses
Intl solves everyday UI text problems. Common uses:
Use
How Intl helps
Prices and stats
Show numbers and currencies the way readers expect for their locale.
Dates and schedules
Format calendar days and clock times with a chosen time zone.
Sorted labels
Sort names and titles with Collator instead of raw code-point order.
Friendly lists and relative times
Build "A, B, and C" or "3 days ago" without hard-coding English only.
Code
JavaScript Examples
Three short programs. Each one prints plain text that is the same every time you run it.
Example 1 — A Quick Tour of Intl
Format a number, a UTC date and a short list with three Intl constructors.
JavaScript
const d = new Date(Date.UTC(2024, 5, 15, 12, 0, 0));
console.log("Price: " + new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(19.99));
console.log("Date: " + new Intl.DateTimeFormat("en-US", { timeZone: "UTC" }).format(d));
console.log("List: " + new Intl.ListFormat("en").format(["A", "B", "C"]));
Intl is a built-in object with constructors and static methods for locale-aware formatting, collation, plural rules and locale tag helpers.
No. Intl is a global object in browsers and in Node.js. You call it directly.
A BCP 47 string such as en-US or de-DE that names a language and often a region. Formatters use it to pick wording and separators.
Newer ones such as Segmenter, DurationFormat, supportedValuesOf, DisplayNames, ListFormat, RelativeTimeFormat and Locale may be missing on older engines. Check typeof before use.
Start with NumberFormat and DateTimeFormat for everyday UI text, then read Collator and ListFormat. Use the methods index to jump to a specific API.