Favorites

JavaScript Intl.Collator Object

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Intl.Collator
JavaScript Internationalization · ConstructorThis object is supported by all modern browsers.
Updated 28th November 2026

Intl.Collator compares strings in a language-aware way, for sorting names and words correctly, including accents and numbers within text.

Description

Intl.Collator creates an object for language-sensitive string comparison. Its compare function returns a negative, zero or positive number and can be passed straight to Array.prototype.sort(). Unlike the default sort, it places accented letters next to their base letters and follows each language's alphabet.

Options include numeric: true to sort "item 10" after "item 2", and sensitivity: 'base' to treat "a", "A" and "á" as equal. For sorting many strings it is faster than calling localeCompare() each time.

The usage option can be set to 'search' for matching rather than sorting, and the caseFirst option decides whether upper or lower case sorts first. Some languages have several sort orders, such as German phonebook order, which you can request with a locale extension like 'de-u-co-phonebk'. Collation is what makes sorted lists of names feel natural to speakers of each language.

Creating

new Intl.Collator(locales, options)

Example

const names = ['Zoë', 'adam', 'Émile', 'Bob'];
console.log([...names].sort());
console.log([...names].sort(new Intl.Collator('en').compare));

const files = ['item10', 'item2', 'item1'];
console.log(files.sort(new Intl.Collator(undefined, { numeric: true }).compare));
console.log(new Intl.Collator('en', { sensitivity: 'base' }).compare('a', 'Á'));

Browser Support

The following information will show you the current browser support for the Intl.Collator object. Hover over a browser icon to see the version that first introduced support for this object.

This object is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee