JavaScript (ES2026) reference · Number Methods and Properties

JavaScript number.toLocaleString() Method

Format a number for display using locale rules: thousands separators, decimals, currency and percentages.

JavaScript (ES2026) Since ES3

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

number.toLocaleString(locales, options)

Parameters

ParameterDescription
locales optional For example "en-US", "de-DE", "hi-IN".
options optional For example { style: "currency", currency: "EUR" }.

Return value

A string.

Examples

Thousands separators by localeTry it yourself
const n = 1234567.891;
console.log(n.toLocaleString("en-US"), "|", n.toLocaleString("de-DE"), "|", n.toLocaleString("hi-IN"));

Output

1,234,567.891 | 1.234.567,891 | 12,34,567.891
Currency and percentagesTry it yourself
console.log((49.9).toLocaleString("en-GB", { style: "currency", currency: "GBP" }));
console.log((0.256).toLocaleString("en-US", { style: "percent", maximumFractionDigits: 1 }));

Output

£49.90
25.6%

Version history

VersionChange
JavaScript ES3Added

In other languages

Was this page helpful?