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
Syntax
number.toLocaleString(locales, options)
Parameters
| Parameter | Description |
|---|---|
locales optional |
For example "en-US", "de-DE", "hi-IN". |
options optional |
For example { style: "currency", currency: "EUR" }. |
Return value
A string.
Examples
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
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
| Version | Change |
|---|---|
| JavaScript ES3 | Added |
In other languages
number_format()· PHP
Related
number.toFixed()· Format a number with a fixed number of decimal places, returned as a string. Rounds, but floating-point quirks apply.- JavaScript Numbers · tutorial
- JavaScript Type Conversion · tutorial