Sort Lines Alphabetically
Sort lines of text A to Z, Z to A, by length, numerically or randomly. Remove duplicates, trim whitespace and copy the sorted list free.
About the Sort Lines Alphabetically
This free line sorter puts any list in order instantly. Paste your lines and choose a sort: alphabetical A to Z or Z to A, shortest or longest first, numeric for lists of numbers, random shuffle, or simply reverse the current order. The sorted result appears live with a line count and copy button.
Three clean-up options run alongside the sort. Remove duplicates keeps only the first occurrence of each line, ignore case treats "Apple" and "apple" as equal, and trim lines strips invisible leading and trailing spaces that so often sneak in when copying from spreadsheets and emails.
Use it to alphabetise name lists, bibliographies and glossaries, order CSS properties or import lists, dedupe email exports, sort numbers without a spreadsheet, or shuffle entries for a fair random order — all privately in your browser.
How to Use the Sort Lines Alphabetically
- 1Paste your list with one item per line.
- 2Pick a sort order: A-Z, Z-A, by length, numeric, random or reverse.
- 3Tick remove duplicates, ignore case or trim lines as needed.
- 4Copy the sorted list with one click.
Frequently Asked Questions
How do I put a list in alphabetical order?
Paste the list with one item per line and choose "Alphabetical (A to Z)" — the sorted version appears immediately. The sort uses locale-aware comparison, so accented letters like é are placed sensibly rather than dumped at the end. Enable "Ignore case" to interleave capitalised and lowercase entries naturally.
How does numeric sorting differ from alphabetical sorting?
Alphabetical sorting compares character by character, so 10 comes before 2 because "1" precedes "2". Numeric sort extracts the number from each line and compares actual values, ordering 2 before 10 correctly. It handles decimals, negative numbers and lines with surrounding text, and non-numeric lines drop to the bottom.
Can this tool remove duplicate lines while sorting?
Yes — tick "Remove duplicates" and only the first occurrence of each line survives. Combine it with "Ignore case" so "Apple" and "apple" count as the same entry, and "Trim lines" so entries differing only by stray spaces are deduplicated too. A counter shows exactly how many duplicates were removed.
What does random shuffle do and is it fair?
Random shuffle rearranges your lines in a completely random order using the Fisher-Yates algorithm, the standard method that gives every possible ordering equal probability. It is handy for randomising presentation order, drawing a raffle sequence or ordering quiz questions. Click "Shuffle again" for a fresh arrangement each time.
Does sorting handle empty lines and extra whitespace?
Empty lines are removed automatically so they never clutter the sorted output. With "Trim lines" enabled (the default), leading and trailing spaces and tabs are stripped from each line before sorting, which prevents invisible whitespace from pushing entries to the wrong position — a common problem with text copied from spreadsheets.