Text Sorter
Sort any list of lines alphabetically, numerically, by length, or shuffle them randomly — instantly in your browser.
Disclaimer. This tool is provided for informational purposes only. Verify important results independently. Read full disclaimer →
About Text Sorter
Sorting text alphabetically, numerically, or by line length is a fundamental data processing task. Alphabetical sorting can be case-sensitive (uppercase before lowercase) or case-insensitive (standard dictionary order). Numerical sorting correctly handles numbers embedded in text - natural sort order places "item2" before "item10", whereas standard alphabetical sort would place "item10" before "item2".
Practical applications: sorting a list of names or keywords alphabetically for better readability; sorting items by length to find the longest or shortest entries; sorting log entries or transaction records; reordering a bulleted list; sorting comma-separated values for easier comparison. Reverse sorting (Z to A, or largest to smallest) is equally supported. For sorting structured data like CSV files, use a spreadsheet application for better column control.
Worked Example
Suppose you paste five hotel room labels, one per line: Room 12, Room 3, Room 101, Lobby, Room 25. Here is what each button produces with “Trim whitespace” ticked.
- A → Z: Lobby, Room 101, Room 12, Room 25, Room 3. The tool compares text character by character, so “Room 101” lands before “Room 3”.
- 1 → 9: Room 3, Room 12, Room 25, Room 101, Lobby. The first number found in each line is used as the sort key, and the line with no number goes to the end.
- 9 → 1: Lobby, Room 101, Room 25, Room 12, Room 3. The line with no number moves to the top because the comparison is simply reversed.
Common Mistakes
- Using A → Z on lines that contain numbers. You get “Room 101” ahead of “Room 3”. Switch to the numeric buttons when the number matters.
- Expecting numeric sort to read thousands separators. A line such as “$1,200” is read as the number 1, because the sort key stops at the comma. In a test, $1,200, $950 and $30 came out as $1,200, $30, $950. Remove the commas first.
- Turning off trimming by accident. With trimming off, a line that begins with a space sorts ahead of the others, so “ zebra” appears above “apple”.
- Trusting a single shuffle as a fair draw. Shuffle uses a quick random comparator, which is fine for reordering a playlist but not suitable for anything where fairness is formally audited.
- Forgetting blank lines. Empty lines are kept and counted, so they cluster at the top of an A → Z result.
Where You Would Use This
- Putting a bibliography, glossary or list of names into alphabetical order before pasting it into a document.
- Ordering file names or ticket references that carry a number, so that item 3 comes before item 12.
- Using the length buttons to spot the longest and shortest keywords, page titles or product names in a list.
- Shuffling quiz questions, raffle names or a practice playlist so the order is different each time.
The Lines counter below the output confirms that nothing was lost during sorting, which is a quick sanity check before you copy the result.
A practical routine: paste the list, leave trimming on, and pick the button that matches the type of data. For plain words use A → Z. For anything with a number inside, such as invoice references or episode titles, use 1 → 9. Then glance at the Lines counter to confirm the count matches your original list, and use the Copy button to move the sorted text elsewhere. If the order still looks wrong, the usual cause is a stray space, a comma inside a number or a mix of capital and lowercase starts.