Text Sorter
Sort lines of text alphabetically, reverse the order, shuffle them randomly, or remove duplicate lines. Paste your list and click the operation — results appear instantly.
⏱ 7 min read · Complete guide below
Text Sorter
How to Use the Text Sorter
- 1Paste your list, one item per line.
- 2Choose an operation: A–Z, Z–A, shuffle, or remove duplicates.
- 3Read the result instantly and copy it out.
- 4Chain operations — remove duplicates first, then sort A–Z — for a clean, deduplicated list.
Worked Example: Cleaning a Messy Email List
You have a pasted column of 200 signup emails with some entered twice. Run Remove Duplicates first: it keeps the first occurrence of each unique line and drops the rest, so 200 lines might collapse to 187. Then run Sort A–Z to alphabetise them for easy scanning. The two operations in that order give you a deduplicated, ordered list ready to paste into a mail tool — no spreadsheet formula required.
One gotcha worth knowing: sorting treats every line as text, not numbers. So a list of 2, 10, 1, 20 sorts to 1, 10, 2, 20 — because the character “1” comes before “2”, “10” lands right after “1”. If you need true numeric order, zero-pad the values first (01, 02, 10, 20) and text-sorting then matches numeric sorting. Deduplication is also case-sensitive, so “Apple” and “apple” are kept as two distinct entries — normalise case beforehand if that matters.
Four Operations, Many Uses
Although it looks simple, the text sorter bundles four genuinely handy operations. Sort A–Z and Z–A alphabetise a list for easy scanning or to meet a style requirement, such as ordered import statements or an index. Reverse flips the current order without re-sorting, which is perfect for turning a chronological list newest-first. Shuffle randomises the order, useful for fairly randomising survey questions, drawing names, or breaking up a predictable sequence. Remove duplicates strips repeated lines, keeping the first occurrence of each. The real power comes from chaining them — for instance, remove duplicates and then sort A–Z to produce a clean, unique, alphabetised list in two clicks, something that would otherwise need a spreadsheet formula or a script.
The Text-vs-Number Sorting Trap
The single most common surprise with any line sorter is that it sorts as text, not as numbers. Because each line is compared character by character, “10” sorts before “2” — the character “1” comes before “2”, so anything starting with 1 lands first, regardless of the number's actual value. This is correct string behaviour, not a bug, and it applies to file names, version numbers, and any mixed list too. The fix is simple: zero-pad your numbers to equal width (01, 02, 10, 20) before sorting, and the text order will match numeric order. Similarly, remember that deduplication here is case-sensitive, so “Apple” and “apple” count as different lines — normalise the case first if you want them treated as the same.
Why Sort in the Browser
You could sort a list in a spreadsheet or with a command-line tool, but a browser-based sorter is often quicker and always more private. There is nothing to open, no formulas to write, and no upload — you paste, click, and copy. Because the entire operation runs locally in your browser's memory, even large lists of tens of thousands of lines sort essentially instantly, and your data never leaves your device. That privacy matters when the list contains email addresses, customer names, internal identifiers, or any other sensitive content, which is exactly the kind of data people most often need to sort and deduplicate. It also means the tool keeps working offline once the page has loaded.
Uses for the Text Sorter
Sort Todo Lists
Paste your task list, sort A–Z, and get a consistently ordered list that is easier to scan and prioritise. Works great for project task lists and grocery lists alike.
Deduplicate Mailing Lists
Paste a list of email addresses or names, click "Remove Duplicates", and get a clean unique list. Saves time compared to manual scanning for duplicates.
Randomise Survey Questions
Shuffle a list of survey questions or answer choices to randomise their order for different respondents. Reduces order bias in questionnaire design.
Sort Code Import Lists
Many style guides require sorted import statements. Paste your imports, sort A–Z, and paste back. Much faster than sorting manually in an editor.
Reverse for LIFO Processing
If you have a chronological list and need to process the most recent items first, click "Reverse" to invert the order without manually reordering each line.
Clean Word Lists for NLP
Sort and deduplicate keyword lists, vocabulary sets, or stopword lists before using them in natural language processing pipelines or search tools.
Frequently Asked Questions
How does alphabetical sorting work?
Lines are sorted using the locale-aware localeCompare function, which correctly handles accented characters and Unicode text. Sorting is case-insensitive in terms of collation order — uppercase and lowercase versions of the same letter sort together according to the locale rules of the browser.
What does "Remove Duplicates" do?
"Remove Duplicates" keeps only the first occurrence of each unique line and discards subsequent duplicates. The comparison is case-sensitive — "Apple" and "apple" are treated as different lines. The original order of first-seen lines is preserved.
Is the Shuffle truly random?
Shuffle uses Math.random(), which produces a pseudo-random sequence from the browser's built-in random number generator. This is suitable for most practical purposes but is not cryptographically secure. For security-critical randomness, use a dedicated cryptographic tool.
Can I sort a list of numbers?
The tool sorts lines as text strings, not as numbers. This means "10" sorts before "2" in A–Z order because "1" comes before "2" as characters. If you need numeric sorting, convert your list to zero-padded numbers (01, 02, 10) before sorting.
Is there a line limit?
No hard limit. The tool processes text in your browser's memory. In practice, lists of tens of thousands of lines sort instantly. Extremely large lists (millions of lines) may cause brief lag in some browsers.
Does it work with non-English text?
Yes. Sorting uses localeCompare, which handles Unicode and accented characters correctly for most languages. The sort order may vary slightly by browser locale setting, but Latin-script languages (including French, German, Spanish, and Portuguese) are handled well.
Why does "10" sort before "2" when I sort my list?
Because the tool sorts lines as text, comparing them character by character rather than by numeric value. The character "1" comes before "2", so any line starting with 1 — including "10" — sorts ahead of "2". This is standard string sorting, not an error. To get true numeric order, zero-pad your numbers to the same width (01, 02, 10, 20) before sorting, and the text order will then match numeric order.
How do I get a clean, unique, alphabetised list in one go?
Chain two operations. First click Remove Duplicates, which keeps the first occurrence of each unique line and drops the rest, then click Sort A–Z to alphabetise the result. Because each operation works on the current output, you end up with a deduplicated, ordered list in two clicks — no spreadsheet formula or script needed. This is one of the most common workflows for cleaning up pasted email lists, keyword lists, and similar data.
Is removing duplicates case-sensitive?
Yes. The duplicate removal compares lines exactly, so "Apple" and "apple" are treated as two different entries and both are kept. If you want case-insensitive deduplication — treating differently-cased versions of the same word as duplicates — normalise the case first, for example by converting everything to lowercase with a case converter, then run Remove Duplicates. The tool preserves the original order of the first-seen lines.
Is it safe to sort a list of private data like emails?
Yes. All sorting, shuffling, and deduplication happen entirely in your browser's memory, so your list is never uploaded to a server, logged, or stored anywhere. This makes it safe to paste sensitive data such as email addresses, customer names, or internal identifiers. As a bonus, because there is no server round-trip, the tool continues to work even if you go offline after loading the page.