JavaScript toLocaleString() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Object

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.

JavaScript
obj.toLocaleString()
CallWhat 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
JavaScript
obj.toLocaleString()
JavaScript
object.toLocaleString(): string

Parameters

ParameterDescription
(none for plain Object)The Object.prototype version takes no required parameters. Number/Date overrides accept locales and options.

Return Value

Return ValueDescription
stringA 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.

JavaScript
var user = { name: "Ada" };

console.log(user.toLocaleString());
console.log(user.toString());
console.log(user.toLocaleString() === user.toString());
Try It Yourself

How It Works

  1. Default text. A plain object becomes "[object Object]".
  2. Same as toString. For ordinary objects, both methods match.
  3. 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.

JavaScript
var price = 1234567.89;

console.log(price.toLocaleString("en-US"));
console.log(price.toLocaleString("de-DE"));
console.log(price.toLocaleString("en-IN"));
Try It Yourself

How It Works

  1. US format. Comma thousands and a dot decimal.
  2. German format. Dot thousands and a comma decimal.
  3. India format. Indian grouping style for thousands.

Dates Print in Local Style

A fixed date shows how locales change the text.

JavaScript
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" }));
Try It Yourself

How It Works

  1. US date order. Month comes before day in the US locale.
  2. GB date order. Day comes before month in the British locale.
  3. Options help. Passing timeZone keeps the example stable across machines.

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.

100% Browser support
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 support
Object.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.

Next: toString()

Convert an object to a string.

toString() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

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