Overview
Introduction
Alphabetizing a pasted list, names, tags, file paths, is quick with a dedicated sort instead of manually reordering lines by eye.
It runs entirely client-side, so nothing you paste is ever uploaded to a server.
What Is Text Sorter?
A line sorter that alphabetizes newline-separated text using locale-aware string comparison, with an option to reverse the order.
It runs entirely client-side as part of this site's String Tools collection, so nothing you paste is ever uploaded to a server.
How Text Sorter Works
The input is split into lines, sorted with localeCompare() for human-friendly ordering, and optionally reversed for descending order.
The transformation happens synchronously in JavaScript the moment you type, with no network round trip involved.
When To Use Text Sorter
Use it to alphabetize a pasted list of names, tags, or file paths.
It's a fast way to get the answer without opening a code editor, a REPL, or writing a one-off script just to check.
Often used alongside Text Splitter and Text Joiner.
Features
Advantages
- Locale-aware comparison generally matches human expectations better than raw character-code sorting.
- One-click toggle between ascending and descending order.
Limitations
- Doesn't deduplicate; repeated lines remain repeated, just adjacent after sorting.
Examples
Best Practices & Notes
Best Practices
- Remove duplicate or blank lines first if you need a clean, deduplicated sorted list.
Developer Notes
Sorting uses `(a, b) => a.localeCompare(b)` rather than the default comparator (which sorts by UTF-16 code unit and can produce surprising results for accented characters or mixed case), then optionally reverses the array for descending order.
Text Sorter Use Cases
- Alphabetizing a pasted list of names or tags
- Sorting file paths or identifiers for review
- Preparing a sorted list for a changelog or index
Common Mistakes
- Expecting duplicates to be removed automatically.
Tips
- Pair with Remove All Empty Lines first if your pasted list has stray blank lines.