Text Sorter
Sort a list of lines from A to Z, Z to A, or by length. Choose whether to trim spaces, drop empty lines and remove duplicates, then copy the sorted list.
A → Z ignores upper and lower case and sorts numbers by value, so “item 2” comes before “item 10”. Lines that tie keep their original order. Duplicate removal only removes exact matches.
How to Use the Text Sorter
- Paste your list into the input box with one item per line.
- Pick a sort order: A → Z, Z → A, shortest → longest or longest → shortest.
- Choose whether to trim spaces, remove empty lines and remove duplicate lines.
- Copy the sorted list or save it as a text file.
Examples
A → Z
- Input
- banana Apple cherry apple
- Output
- Apple apple banana cherry
Shortest → longest
- Input
- pear fig banana kiwi
- Output
- fig pear kiwi banana
About the Text Sorter
Sorting lines is handy for tidying name lists, keywords, tags, file names, glossary terms or any list copied from a spreadsheet or document. Each line is treated as one item.
Alphabetical sorting ignores upper and lower case and compares numbers by value, so "item 2" comes before "item 10". Length sorting counts characters in each line. When two lines are equal for the chosen order, they keep the order they had in your input, so results are predictable.
Duplicate removal only removes lines that match exactly, including case, so "Apple" and "apple" are both kept. Use the Remove Duplicates tool if you only need unique lines without sorting. The calculation runs in your browser with JavaScript, and this tool does not send what you enter to a Usevanta server.
Frequently Asked Questions
Is the alphabetical sort case-sensitive?
No. Upper and lower case letters are sorted together, so "Apple" and "apple" sit next to each other. Lines that compare as equal keep their original order.
How are numbers sorted?
Numbers inside lines are compared by value, so "2" comes before "10". This is often called natural sorting.
What happens to empty lines?
They are removed by default. Turn off "Remove empty lines" to keep them; they will then sort to the top for A → Z and shortest → longest.
Can I remove duplicates while sorting?
Yes. Turn on "Remove duplicate lines" to keep only the first copy of each exact line before sorting.
Is my list sent to a server?
The calculation runs in your browser with JavaScript, and this tool does not send what you enter to a Usevanta server.
Related Tools
All text tools →Remove repeated lines from lists and keep the first occurrence.
Collapse repeated spaces, trim lines and tidy up blank lines in any text.
Reverse text by characters, by word order or by line order.
Count how often each word appears in a text, with total and unique word counts.