Sort Text Lines
Sort any list in seconds: alphabetically in either direction, in natural order so item 2 comes before item 10, by the number at the start of each line, by line length, reversed, or in a random order drawn with your browser's cryptographic random generator. Optional clean-up removes empty lines and duplicates.
Sort the Lines of Your Text
Sorted lines
Summary
How to Use the Sort Text Lines
- Paste your list into the box, one item per line.
- Choose an order, for example A to Z, Natural order or Random shuffle.
- Tick the clean-up options: ignore case, remove empty lines, remove duplicates, trim.
- Copy or download the sorted list; for a new random order press Shuffle again.
About This Tool
People organising name or keyword lists, developers sorting configuration entries, teachers drawing a random order and analysts ordering numeric data.
Input: Plain text, one item per line · Output: Sorted lines.
Features and Limitations
Features
- Ten ordering modes including natural, numeric, length and random.
- Alphabetical order follows your browser's language rules, so accented letters sort sensibly.
- Random order uses crypto.getRandomValues with an unbiased shuffle.
- Optional trimming, empty-line removal and de-duplication in the same step.
Limitations
- Alphabetical order depends on your browser's locale; some languages sort differently in other browsers.
- In numeric order the number at the start of the line is used; lines without one go to the end in their original order.
- Sorting works line by line and cannot sort by a column or field inside a line.
- Results are computed in your browser; nothing you enter is sent to a server.
Example
The lines item10, item2, Item1 sort to Item1, item10, item2 alphabetically, but to Item1, item2, item10 in natural order.
Frequently Asked Questions
What is natural sort order?
It compares the numbers inside text by value, so item2 comes before item10. Plain alphabetical order puts item10 first because “1” is less than “2”.
Is the random shuffle really random?
It uses the browser's cryptographically secure random numbers and an unbiased Fisher–Yates shuffle, so every order is equally likely.
How does numeric order handle text?
The number at the start of each line is read (decimals, negatives and thousands commas are accepted). Lines with no leading number are placed after the numbers.
Can I sort without losing blank lines?
Yes, untick Remove empty lines. Blank lines will then sort to the top in A to Z order.
Related Tools
More like this: all Transform & Compare tools, all Text & Writing tools or the TinySandy home page.