JavaScript toLocaleString() Method

Definition
obj.toLocaleString() asks the object for a locale-aware string. On a plain object it usually falls back to the same result as toString().
Types like Date, Number, and Array override it to format values for a language or region. You can pass locales and options on those specialized types.
Syntax
Call obj.toLocaleString() like this. Start with this line.
| Call | What it does |
|---|
obj.toLocaleString() | Returns a locale-aware string for types that support it. |
({}).toLocaleString() | Usually "[object Object]", same as toString(). |
(1234.5).toLocaleString("en-IN") | Formats the number for an Indian English locale. |
Plain objects ignore locale arguments. Dates and numbers use them for formatting.
Library declarations
object.toLocaleString(): string
Parameters
| Parameter | Description |
|---|
| (none for plain Object) | The Object.prototype version takes no required parameters. Number/Date overrides accept locales and options. |
Return Value
| Return Value | Description |
|---|
| string | A string meant for display in a local format when the type supports it. |
JavaScript Examples
Plain Objects Fall Back to toString
See what a normal object prints.
var user = { name: "Ada" };
console.log(user.toLocaleString());
console.log(user.toString());
console.log(user.toLocaleString() === user.toString());
[object Object]
[object Object]
true
How It Works
- Default text. A plain object becomes
"[object Object]". - Same as toString. For ordinary objects, both methods match.
- Override if needed. Define your own
toLocaleString when you want custom display text.
Numbers Use Locale Formatting
Call the Number version through a value that overrides the method.
var price = 1234567.89;
console.log(price.toLocaleString("en-US"));
console.log(price.toLocaleString("de-DE"));
console.log(price.toLocaleString("en-IN"));
1,234,567.89
1.234.567,89
12,34,567.89
How It Works
- US format. Comma thousands and a dot decimal.
- German format. Dot thousands and a comma decimal.
- India format. Indian grouping style for thousands.
Dates Print in Local Style
A fixed date shows how locales change the text.
var day = new Date(Date.UTC(2026, 0, 15, 12, 0, 0));
console.log(day.toLocaleString("en-US", { timeZone: "UTC" }));
console.log(day.toLocaleString("en-GB", { timeZone: "UTC" }));
1/15/2026, 12:00:00 PM
15/01/2026, 12:00:00
How It Works
- US date order. Month comes before day in the US locale.
- GB date order. Day comes before month in the British locale.
- Options help. Passing
timeZone keeps the example stable across machines.
Compatibility
Browser & Runtime Support
toLocaleString() has existed since early JavaScript (ES1). Locale options grew richer in later ECMAScript editions.
✓ ES1 · Baseline
obj.toLocaleString()
Available everywhere. Exact date/number text can differ slightly by engine and ICU data.
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full supportObject.prototype.toLocaleString Excellent
Bottom line: Safe to call. For plain objects prefer a custom formatter; for numbers and dates, toLocaleString is very useful.
Frequently Asked Questions
It returns a locale-aware string. On plain objects it usually matches toString(). Dates and numbers format for a locale.
Because plain objects do not know a special local format. Override toLocaleString or format fields yourself.
The Object.prototype version does not use locale arguments. Pass them on Number or Date values instead.
The idea is the same, but exact punctuation and calendar details can vary by engine.
toString is the general string conversion. toLocaleString is meant for locale-sensitive display when a type supports it.
About the author
Developer, cloud engineer, and technical writer
I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.
8 people found this page helpful