Text Sorter
Sort lines of text alphabetically, numerically, or by length in ascending or descending order.
Alphabetical sorting arranges lines using standard locale-aware string comparison. This is the default choice for sorting names, titles, glossary terms, or any list of words. Numerical sorting parses each line as a number and orders them by value, which is essential when your lines contain quantities, prices, scores, or any numerical data. Alphabetical sorting would incorrectly place "9" after "10" because it compares character by character, but numerical sorting handles this correctly. By-length sorting orders lines by their character count, which is useful for finding the shortest or longest entries in a list, organizing data by content density, or formatting output for readability.
Each mode works in both ascending and descending directions. Ascending alphabetical runs A through Z. Descending reverses that to Z through A. The same logic applies to numerical and by-length modes. Empty lines are preserved in their relative positions during sorting.
The tool splits your input on newline characters, sorts the resulting array, and joins the lines back together. All processing runs in your browser with no server communication. It handles Unicode text correctly, so international characters and accented letters sort in their expected positions.
Sorter
Results
How to Use
- Paste your text with one item per line into the input field
- Select the sort direction: ascending or descending
- Select the sort type: alphabetical, numerical, or by length
- Click Calculate to sort the lines
- Copy the sorted text from the output field
FAQ
How does numerical sorting handle non-numeric lines?
Lines that cannot be parsed as numbers are treated as zero when using numerical sort. For best results, ensure all lines contain numeric values when using this mode.
Is the sorting case-sensitive?
Alphabetical sorting uses locale-aware comparison which is case-insensitive by default, so uppercase and lowercase versions of the same letter sort together.
Can I sort a comma-separated list?
This tool sorts by lines, not by commas. To sort a comma-separated list, first put each item on its own line, sort, then rejoin with commas if needed.
What happens with empty lines?
Empty lines are included in the sort. In alphabetical ascending order, empty lines will sort to the top. You can use the Text Deduplicator or Remove Extra Spaces tool to clean up empty lines separately.
Commonly Used With
Pair this tool with others in Text Utilities
Learn More
Guides that feature this tool