Text Sort & Reverse Tool
Sort text lines alphabetically or by length and number, reverse the order, flip each line, or shuffle randomly — with dedup and skip-empty options.
Enter some text above first.
About the sort modes
Ascending and descending sorts use locale-aware comparison: English by alphabet and numbers by value rather than digit by digit, so "Chapter 9" correctly comes before "Chapter 10".
"By length" is handy for titles and comments — short lines first for quick scanning. "By number in line" extracts the first number of each line as the sort key, perfect for lists like "file 1.txt", "file 10.txt"; lines without numbers sink to the bottom.
"Shuffle" uses the Fisher-Yates algorithm with uniform randomness — great for raffles and random grouping. "Reverse order" flips the list top to bottom, and "Reverse characters" mirrors each line (abc → cba).
How to use
- Paste your text above, one item per line.
- Toggle "Skip empty lines" or "Dedup" as needed and click an action.
- The result appears below instantly — click "Copy" to take it.
FAQ
How are Chinese lines sorted?
By pinyin, using the browser's built-in Chinese collation, matching the order you would expect from a pinyin input method.
Why would "Chapter 10" appear before "Chapter 9"?
Plain text comparison compares digit by digit, where 1 < 9. This tool compares numbers numerically by default; if needed, "By number in line" always sorts by the numeric value.
Is the shuffle truly random?
Yes — Fisher-Yates shuffling gives every line an equal chance of landing in any position. Click again for a new shuffle.
Are empty lines kept?
"Skip empty lines" is on by default and removes them. Turn it off and empty lines participate in the sort like any other line.