TheTools.World tool
Sort text lines online
Sort a list of lines alphabetically, A to Z or Z to A, with an option to ignore case and to drop blank lines. Useful for cleaning up lists, spreadsheet columns, and reference data pasted as plain text.
Sort your lines
Sort a list of lines alphabetically, A to Z or Z to A, with an option to ignore case and to drop blank lines. Useful for cleaning up lists, spreadsheet columns, and reference data pasted as plain text.
How to sort lines
- Paste your list, one item per line, into the box.
- Choose A to Z or Z to A order.
- Decide whether case should be ignored when sorting (recommended for most lists).
- Decide whether to remove empty lines.
- Click Sort lines and copy or download the result.
Sorting uses your browser's locale-aware comparison, so accented letters and most non-English alphabets sort in a reasonable order, not strict raw character-code order.
How the sort works
Your text is split into lines, then compared using your browser's locale-aware string comparison (via the Intl.Collator API) rather than raw character-code sorting. This means accented letters generally sort next to their unaccented equivalents (so "café" sorts near "cafe", not off at the end near symbols), which matches how most reference lists are expected to sort. With case-insensitive sorting on, "Apple" and "apple" are treated as equal for ordering purposes.
Best practices
- Keep case-insensitive sorting on for general lists (names, tags, categories) so capitalization doesn't split otherwise-identical items apart.
- Turn case-insensitive sorting off if you specifically need strict case-sensitive ordering, such as matching a system that sorts uppercase before lowercase.
- Remove empty lines before sorting if your pasted list has stray blank lines from spreadsheet or document formatting.
Common mistakes to avoid
- Expecting numeric sort behavior. This is an alphabetical sort, so "10" sorts before "2" (because "1" comes before "2" character by character), which can surprise anyone expecting numeric order.
- Not trimming stray whitespace before sorting, which can cause lines that look identical to sort separately if one has trailing spaces.
- Sorting multi-column data pasted as plain text, which will sort by the first column's text only, not by a specific column you might have intended.
Real-world use cases
- Alphabetizing a name list, tag list, or bibliography.
- Cleaning up a list pasted from a spreadsheet before pasting it somewhere that needs alphabetical order.
- Preparing a sorted reference list for documentation or a glossary.
- Quick sanity-checking whether a list is already sorted by comparing the output to your input.
Limitations
This is a plain alphabetical sort, not a numeric or natural sort — a list like "item 2, item 10, item 1" will sort as "item 1, item 10, item 2" because it compares text character by character, not by numeric value. It also sorts by the whole line, so it cannot sort multi-column data by a specific column.
Privacy
Text you sort is processed locally in your browser. It is not sent to a server, logged, or stored. See the privacy policy for the site's full data handling approach.
Troubleshooting
- If numbers don't sort the way you expect, remember this is alphabetical sorting, not numeric sorting.
- If near-identical lines sort separately, check for trailing spaces or invisible characters.
- If you need duplicates removed as well as sorted, run your list through remove duplicate lines first.
Conclusion
Use this tool to alphabetize any plain-text list. To also remove duplicate entries, use remove duplicate lines; to reverse the order of lines without sorting them, use reverse text in line mode.
Related tools
FAQ
Does this sort numbers correctly?
No, this is an alphabetical sort, so "10" will sort before "2". For numeric order you would need a spreadsheet or a dedicated numeric sort tool.
Can I remove duplicates while sorting?
This tool only sorts. Use remove duplicate lines separately (before or after sorting) if you also need duplicates removed.
How does case-insensitive sorting work?
With it enabled, "Apple" and "apple" are treated as equal for ordering purposes, so the list is sorted as if everything were the same case.
Is my text uploaded anywhere?
No. Sorting happens locally in your browser and your text is not sent to a server.