Text Sorter
Sort and clean lists by A to Z, length, numeric, reverse or random order
- 100% Free
- Files stay private
- Works in your browser
Natural order treats embedded numbers correctly (item2 before item10). Sorting, de-duplication and shuffling all happen live in your browser.
How it works
Paste your list
Paste your items into Lines to sort, one per line. Change Input separator if yours are split by commas or another character.
Choose the sort order
Choose a Sort by option such as Alphabetical (A to Z) or By length, then set Direction to Ascending or Descending. The list re-sorts as you change them.
Copy or download the result
Your sorted list appears under Sorted output, with Lines in and Lines out counts. Press Copy result to copy it, or Download to save it.
The Text Sorter is a free online tool that sorts a list of lines alphabetically, naturally, by length, by numeric value, in reverse or at random, while trimming, dropping blanks and removing duplicates as it goes. It is built for anyone holding an untidy list of names, keywords or file names. Sorting happens live in your browser.
At a Glance
| Detail | Summary |
|---|---|
| What it does | Sorts, de-duplicates and cleans a list of text items. |
| Input | Any list, split by new line, comma, semicolon, tab, space, pipe or a custom separator. |
| Output | The sorted list, plus counts for lines in, lines out, duplicates removed and average length. |
| Runs where | Entirely in your browser. |
| Privacy | Your list never leaves your device. |
| Price | Free, no sign-up. |
What Is the Text Sorter?
The Text Sorter splits your text on a separator you choose, cleans the items, orders them, then joins them back with a separator you choose. Alphabetical and Natural sorting use the browser's Intl.Collator, so accented letters sort correctly rather than being pushed past Z. Natural order also reads embedded numbers, which is why file2.txt lands before file10.txt.
The steps run in a fixed order: split, trim, drop blanks, remove duplicates, sort, join. De-duplication runs before sorting and keeps the first occurrence. Shuffle uses a seeded Fisher-Yates shuffle, so the order holds steady while you change other options and only rerolls on Shuffle again.
How the Text Sorter Is Different
A plain sorter alphabetises lines. This one handles the separator, cleaning and ordering in one live pass.
| This Text Sorter | A typical sorter |
|---|---|
Natural order puts file2 before file10 | Alphabetical only, so file10 comes first |
| Separate input and output separators, so it converts formats | One item per line, always |
| Trim, blanks and duplicates cleaned in the same pass | Sorting only |
| Locale-aware collation for accented text | Raw code point comparison |
Who Benefits from This Tool
- Developers: order config keys, and sort file names in natural order.
- Marketers: alphabetise and de-duplicate keyword lists merged from several exports.
- Administrators: clean a list of users or hostnames before importing it.
- Teachers: shuffle quiz questions or answer options to break up a pattern.
- Analysts: tidy a column pasted out of a spreadsheet without writing a formula.
Key Features
- Six sort modes: Alphabetical, Natural (file-name order), By length, Numeric value, Reverse input order and Shuffle, each ascending or descending. Direction is greyed out for Reverse and Shuffle.
- Four cleaning toggles: Trim each line and Remove blank lines are on by default; Remove duplicates and Case-sensitive are off.
- Separator conversion: pick any separator for input and a different one for output, so a list of lines becomes a comma-separated string.
- Live counts: lines in, lines out, duplicates removed and average length, so you see what the cleaning did.
- Chain and export: Use as input feeds the result back into the box for a second pass, and Download saves it as
sorted.txt.
How to Use
- Paste your list into the box, one item per line, or set the input separator to match your data.
- Choose a sort mode and a direction. The output updates as you go.
- Turn on Remove duplicates if you are merging lists, and Case-sensitive if
Appleandappleshould stay separate. - Set an output separator if you want a different format.
- Copy the result, download it, or press Use as input to run another pass.
Worked Example
Paste six lines: banana, Apple, apple, an empty line, cherry and banana. Leave Trim each line and Remove blank lines on, turn on Remove duplicates, and sort Alphabetical ascending. The output is Apple, banana, cherry, and the counts read lines in 6, lines out 3, duplicates removed 2, average length 5.7. Apple survives rather than apple because de-duplication keeps the first occurrence. Turn Case-sensitive on and four lines come out instead, with only one duplicate removed.
Common Use Cases
- Alphabetising a list of names, tags or keywords.
- Removing duplicates from two lists pasted together.
- Turning a column of lines into a comma-separated string for an import field.
- Sorting file names or version strings so numbers read in human order.
Tips and Best Practices
- Leave Trim each line on when de-duplicating. Without it,
appleandapplecount as different items. - Use Natural rather than Alphabetical for anything with numbers in it, such as file names or versions.
- Case-sensitive changes both matching and sorting, so use it only when capitalisation is meaningful.
- Chain passes with Use as input. Clean and de-duplicate first, then sort the smaller list.
Limitations and Notes
- Splitting is a plain split on the separator. A quoted CSV field containing a comma will be broken in two, so use a real CSV tool for that.
- Numeric mode strips everything except digits, dots and minus signs, then reads the number. A line with no number counts as zero, and
192.168.1.10will not order as an address. - There is no multi-column sort and no regular expression filtering. Each item is compared whole.
- Nothing is saved: refreshing clears the box.
FAQs
Natural order reads embedded numbers as numbers. Sorting file10.txt, file2.txt and file1.txt alphabetically gives file1.txt, file10.txt, file2.txt. Natural order gives file1.txt, file2.txt, file10.txt, which is what people expect.
The first one in your original list, because de-duplication runs before sorting. If Apple appears above apple and matching is case-insensitive, Apple is kept. Turn on Case-sensitive to treat them as separate items.
No. Every step runs in your browser, so the list never reaches a server and nothing is stored. Refreshing clears the box, so copy or download anything you want to keep.
Shuffle is seeded, so the order is stable until you reroll it. Toggling a cleaning option will not silently reshuffle your list. Press Shuffle again for a new order.
Yes. Alphabetical and Natural sorting use the browser's Intl.Collator, which places accented letters where a dictionary would rather than after Z. By default it ignores case and accent differences; Case-sensitive switches to a stricter comparison.