Text Sorter – Sort Lines Alphabetically or in Reverse Order
Sort lines of text alphabetically or reverse order.
How to use this text sorter
- Paste your list into the input field, with one item per line
- Choose "Ascending (A-Z)" or "Descending (Z-A)" to set the sort direction
- Optionally check "Remove empty lines" to drop blank lines from the sorted result
- The sorted output updates automatically in the field on the right
- Click the copy button next to the sorted output to copy it to your clipboard
Frequently Asked Questions
How does text sorting work?
The tool sorts lines alphabetically. You can choose ascending (A-Z) or descending (Z-A) order. Empty lines can be optionally removed.
Is the sorting case-sensitive?
The sorting uses case-insensitive comparison, so "Apple" and "apple" will be sorted together, but the original case is preserved.
Can I sort numbers?
Yes, numbers are sorted as text. For example, "10" comes before "2" in alphabetical sorting. For numeric sorting, you would need a different tool.
Related Tools
A text sorter helps writers, developers, and list-makers put lines of text into alphabetical order without doing it by hand. It is useful any time you have a list where each item sits on its own line — names, tags, keywords, bookmarks, or bibliography entries — and you want a clean, predictable A-Z or Z-A ordering. Students use it to alphabetize reference lists, developers use it to sort configuration values or import lists, and content creators use it to organize tag or keyword lists before publishing. Because sorting happens instantly as you type or change options, you can experiment with ascending versus descending order, or with removing blank lines, and immediately see the effect, all without any of your text leaving your browser.
What is text sorter?
A text sorter is a utility that splits your input into lines on the newline character, then reorders those lines alphabetically. If the "remove empty lines" option is enabled, blank lines are filtered out before sorting. Each pair of lines is then compared using the browser's locale-aware string comparison with base sensitivity, which means the comparison ignores case and accent differences when deciding order, even though the original casing of each line is preserved in the output. Depending on whether ascending or descending order is selected, the comparison result is used as-is or reversed, producing an A-Z or Z-A ordering. The sorted lines are then rejoined with newlines to produce the final output, recalculated instantly whenever the input or options change.
Common use cases
- Alphabetizing lists of names, tags, or keywords before publishing or sharing them
- Organizing a list of bookmarks or links into a consistent order
- Sorting bibliography or reference entries for an assignment or paper
- Putting a list of file names or directory entries into alphabetical order for review
- Preparing a sorted contact list or mailing list export
- Cleaning up a pasted list by removing blank lines while alphabetizing it
Limitations and common mistakes
- Sorting is purely alphabetical (text-based), so numbers are compared as strings and "10" will sort before "2" — this tool does not perform numeric sorting
- Comparison uses the browser's default locale settings, so the exact ordering of accented characters or symbols can vary slightly between browsers or operating systems
- The comparison is case-insensitive by design, so there is no option to sort with strict case-sensitive ordering (uppercase before lowercase, for example)
- Removing empty lines is optional and off by default, so if left unchecked, blank lines remain in the list and are sorted along with everything else
- Leading or trailing whitespace on a line is preserved and taken into account during comparison, which can put a line in a slightly different position than its trimmed version would