JavaScript Array toLocaleString() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Array

Definition

Array.prototype.toLocaleString(locales?, options?) turns each element into a locale-aware string (when that type supports it), then joins the pieces into one string. It does not mutate the array. Plain toString() skips localization.

Remember
array.toLocaleString(locales?, options?)

each element → element.toLocaleString(locales, options)
then join with a list separator (often ",")

numbers / dates → locale formatting
plain strings   → not translated

does not mutate the array ✓
pass an explicit locale for predictable output

Syntax

Call array.toLocaleString. Start with this line.

JavaScript
array.toLocaleString(locales?, options?)
CallWhat it does
array.toLocaleString(locales?, options?)Primary signature.
array.toLocaleString(...)Call with the arguments your case needs.

Built into JavaScript. Call toLocaleString(...) on an array instance — no import required.

Library declarations
JavaScript
array.toLocaleString(locales?, options?)

Parameters

ParameterDescription
ArrayRequired. Source values to format (read-only)
localesOptional. BCP 47 tag like "en-US" or "de-DE"
optionsOptional. Forwarded to each element (e.g. currency)

Return Value

Return ValueDescription
*One string (not an array)

JavaScript Examples

Example 1 — Format Numbers (US Locale)

Large numbers get grouping separators for en-US.

JavaScript
const numbers = [1234.5, 9876543.21];

const text = numbers.toLocaleString("en-US");

console.log(text);
// "1,234.5,9,876,543.21"
Try It Yourself

How It Works

  1. Pick a locale. "en-US" uses commas for thousands and a dot for decimals.
  2. Format each number. Each value calls its own toLocaleString.
  3. Join the parts. Formatted strings are joined with a list separator (comma).
  4. Array unchanged. numbers still holds the original numeric values.

Example 2 — Currency Formatting

Pass style and currency in the options object.

JavaScript
const prices = [1000, 2500, 99.5];

const text = prices.toLocaleString("en-US", {
  style: "currency",
  currency: "USD"
});

console.log(text);
// "$1,000.00,$2,500.00,$99.50"
Try It Yourself

How It Works

  1. Set currency options. style: "currency" and currency: "USD".
  2. Apply per element. Each price formats as a US dollar amount.
  3. Join into one string. Useful for quick price-list displays.
  4. Custom separator tip. Use map + join if you need " | " instead of commas.

Example 3 — toLocaleString() vs toString()

Same array — plain conversion vs locale grouping.

JavaScript
const values = [1234567.89];

console.log(values.toString());
// "1234567.89"
console.log(values.toLocaleString("en-US"));
// "1,234,567.89"
Try It Yourself

How It Works

  1. toString is plain. No thousand separators — just default string form.
  2. toLocaleString adds rules. en-US inserts grouping commas.
  3. Same source array. Neither method changes values.
  4. When to choose. UI for humans → locale; simple debug dump → toString / join.

Browser & Runtime Support

Array.prototype.toLocaleString() has been available since ES3. Passing locales and options relies on the engine’s Intl support (strong in all modern browsers).

✓ Baseline · ES3 + Intl

Array.prototype.toLocaleString()

Supported in every major browser and Node.js. Rich currency/date options work wherever Intl.NumberFormat / Intl.DateTimeFormat are available.

99% Near-universal 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
Array.toLocaleString() Excellent

Bottom line: Safe for modern apps. Always pass an explicit locale in shared code so formatting does not silently change with the user’s system settings.

Frequently Asked Questions

toLocaleString() converts each array element to a string using locale-aware formatting (when the element supports it), then joins them with a list separator (often a comma). It returns one string and does not mutate the array.
No. toLocaleString() only reads elements and returns a new string. The original array is unchanged.
Both join elements into one string. toLocaleString() passes locale and options to each element's toLocaleString method, so numbers and dates format for a region. toString() uses default string conversion without localization.
locales is a BCP 47 language tag (e.g. 'en-US', 'de-DE') or an array of tags. options is an object forwarded to each element's toLocaleString—for example { style: 'currency', currency: 'USD' } for numbers.
No. Plain strings like 'Hello' are not translated. Localization applies to how numbers, dates, and similar values are formatted—not automatic translation of words.
Array.toLocaleString() has been available since ES3 and works in all browsers. Locale and option support depends on the engine's Intl implementation (excellent in modern browsers).

Next: toString()

Learn the simpler array-to-string conversion without locale options.

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.

9 people found this page helpful