Alphabetic Order
Sort any list of words, names, or lines into alphabetical order instantly. Supports A-Z, Z-A, case options, duplicate removal, and export.
About
Alphabetical sorting follows the Unicode Collation Algorithm (UCA), which defines ordering rules for over 150,000 characters across scripts. A naive sort using raw code points produces incorrect results for accented characters: “résumé” would sort after “z” instead of near “r”. This tool uses Intl.Collator with locale-aware comparison, handling diacritics, ligatures, and case folding according to CLDR (Common Locale Data Repository) rules. Mis-sorted reference lists, bibliographies, or data imports cause lookup failures and compliance issues in regulated industries (legal filings, pharmacopeias, ISO 9001 document control).
The tool supports natural numeric collation, so “item2” sorts before “item10” rather than after it. Duplicate detection uses Unicode NFC normalization to catch visually identical strings composed from different code points. Note: sort order is locale-dependent. German dictionaries sort “ö” as “oe”, while Swedish treats it as a separate letter after “z”. This tool defaults to English (en) locale. Adjust expectations for non-Latin scripts accordingly.
Formulas
The core comparison function delegates to the ECMAScript Internationalization API:
Where result < 0 means a precedes b, result > 0 means b precedes a, and result = 0 means they are collation-equivalent.
The sensitivity parameter controls case and accent handling:
accent → a = A ≠ á
case → a ≠ A, a = á
variant → a ≠ A ≠ á
For duplicate detection, each line is normalized: NFC(trim(line)), then compared via a Set using the active sensitivity level. Article stripping applies the regex pattern /^(a|an|the)\s+/i before comparison but preserves the original text in output.
Where locale = BCP 47 language tag (e.g., en, de, sv). numeric = TRUE enables natural number sorting. a, b = two strings being compared.
Reference Data
| Feature | Description | Use Case |
|---|---|---|
| A → Z Sort | Standard ascending lexicographic order per locale | Glossaries, directories, indexes |
| Z → A Sort | Descending reverse alphabetical order | Reverse lookups, priority lists |
| Case Insensitive | Treats a = A during comparison | Mixed-case data normalization |
| Case Sensitive | Uppercase letters sort before lowercase (Unicode default) | Programming identifiers, CSV headers |
| Natural Numeric | item2 < item10 (not string order) | File names, version numbers |
| Remove Duplicates | Eliminates identical lines after NFC normalization | Deduplicating mailing lists, tags |
| Trim Whitespace | Strips leading/trailing spaces per line | Pasted data from spreadsheets |
| Ignore Articles | Skips “A”, “An”, “The” at line start for sorting | Book titles, movie lists, bibliographies |
| Custom Separator | Split by newline, comma, semicolon, or tab | CSV fields, inline lists |
| Ignore Blank Lines | Filters out empty lines before sorting | Pasted multi-paragraph text |
| Number Lines | Prepends 1. 2. etc. to sorted output | Ordered/numbered lists |
| Locale: en | English collation (CLDR). “é” groups near “e” | Default for English text |
| Locale: de | German collation. “ä” = “ae” | German-language lists |
| Locale: sv | Swedish collation. “ö” after “z” | Scandinavian text |
| Locale: fr | French collation. Accent-sensitive ordering | French-language bibliographies |
| Locale: es | Spanish collation. “ñ” between “n” and “o” | Spanish directories |
| Export as .txt | Downloads sorted result as plain text file | Offline use, archiving |
| Copy to Clipboard | One-click copy of sorted output | Pasting into documents |
| Import from File | Load a .txt file directly into the input | Batch processing large lists |