Sort Text Alphabetically
Paste a list and instantly sort the lines from A to Z or Z to A, with options to remove duplicates, ignore case and strip blank lines.
5 lines · 1 blank line removed
How to use the Sort Text Alphabetically
- Paste your list into the input box — one item per line.
- Choose an order: A→Z, Z→A, reverse the current order, or shuffle randomly.
- Tick any options you need: ignore case, remove duplicate lines, remove blank lines, trim spaces or sort by last word.
- Pick how the output is separated — line breaks, commas, semicolons, spaces or pipes.
- The sorted list updates instantly — click Copy to Clipboard or Download to save it.
Examples
| Input | Output | Notes |
|---|---|---|
banana
Apple
cherry | Apple
banana
cherry | A→Z, case-insensitive (default). |
banana
Apple
cherry | cherry
banana
Apple | Z→A order. |
item2
item10
item1 | item1
item2
item10 | Natural number order keeps item10 after item2. |
red
blue
red
green
blue | blue
green
red | A→Z with "remove duplicate lines" on. |
Ada Lovelace
Grace Hopper
Alan Turing | Grace Hopper
Ada Lovelace
Alan Turing | "Sort by last word" orders by surname (Hopper, Lovelace, Turing). |
What does sorting text alphabetically mean?
Alphabetical sorting reorders a list so each line follows dictionary order — A before B, B before C, and so on. This tool works line by line: paste any number of items separated by line breaks and it returns them in order, either ascending (A→Z) or descending (Z→A).
It also handles the jobs that usually go with alphabetising a list: removing duplicates, deleting blank lines, trimming stray spaces, and comparing numbers by value.
Options explained
| Option | Effect |
|---|---|
| A→Z / Z→A | Ascending or descending alphabetical order. |
| Reverse lines | Flips the current order without sorting — last line becomes first. |
| Shuffle | Randomises the line order. |
| Case sensitive | When on, uppercase and lowercase sort separately (Unicode order). |
| Natural number order | "file2" before "file10" instead of after. |
| Remove duplicate lines | Keeps only the first copy of each line. |
| Remove blank lines | Drops empty lines before sorting. |
| Trim whitespace | Strips leading/trailing spaces from every line. |
| Sort by last word | Orders by the final word of each line (surname sorting). |
| Separate output by | Join the sorted items with line breaks, commas, semicolons, spaces or pipes. |
Who uses an alphabetical sorter?
- Students and writers ordering bibliographies, glossaries and reference lists.
- Teachers alphabetising class name lists.
- Developers sorting config keys, import statements, translation strings and word lists.
- Marketers and SEOs tidying keyword lists and de-duplicating them.
- Data entry teams normalising exported lists before import.
Tips
To change the capitalization of the sorted list, run it through the Text Case Converter afterwards. To count how many unique items you ended up with, paste the result into the Word Counter. For turning a sorted list into URL slugs, use the URL Slugify Generator.
Frequently asked questions
How do I sort a list alphabetically online?
Paste your list into the box above with one item on each line, then click A→Z. The lines are reordered alphabetically straight away and you can copy or download the sorted list. No sign-up and no limit on how many lines you paste.
Does it sort by whole lines or by words?
By default each line is treated as one item and the whole line is compared. Turn on "sort by last word" to order by the final word of each line — handy for alphabetising names by surname.
Can it remove duplicate lines?
Yes. Enable "remove duplicate lines" and every repeated line is dropped, keeping only its first occurrence. Combine it with "ignore case" so that "Apple" and "apple" count as the same entry.
What does "natural number order" do?
It compares embedded numbers by value rather than character by character, so "item2" sorts before "item10" instead of after it. Turn it off for a strict character-code sort.
Is capitalisation taken into account?
Only if you tick "case sensitive". With it off (the default) upper- and lowercase letters are mixed together alphabetically. With it on, the sort follows Unicode order, which groups differently.
Can I get the sorted list as a comma-separated line instead of one item per line?
Yes. Use the "separate output by" menu to join the sorted items with commas, semicolons, spaces or pipes instead of line breaks — useful for pasting a list into a spreadsheet cell, a SQL IN () clause or a CSV field.
Is my text uploaded anywhere?
No. All sorting happens in your browser with JavaScript, so your list never leaves your device — safe for private or unpublished content.