Sort Lines Alphabetically
Paste a list with one item per line and it is sorted alphabetically as you type. Switch to Z → A, natural order (item 2 before item 10), length, reverse or shuffle with one click; accents and capitals sort where a reader expects them.
The preview is shortened. Copy and Download include the whole result.
Your text never leaves your device.
How to use
- Paste your list, one item per line.
- Pick an order: A → Z, Z → A, Natural, By length, Shuffle or Reverse order.
- Copy the sorted list or download it as a .txt file.
Examples
- Before
- item 10 item 2 Item 1 banana Éclair apple
- After
- apple banana Éclair Item 1 item 2 item 10
- Before
- kiwi banana fig apple
- After
- fig kiwi apple banana
The six orders
- A → Z sorts alphabetically using the language’s alphabet, ignoring case and accents for the main order.
- Z → A is the exact reverse.
- Natural sorts alphabetically but compares runs of digits by their value: 1, 2, 10, 100 instead of 1, 10, 100, 2.
- By length puts the shortest lines first. Lines of the same length keep their original order.
- Shuffle puts the lines in a random order.
- Reverse order flips the list upside down without sorting it: the last line comes first. Useful for logs and chat exports that are newest-last.
In the first example, A → Z would place “item 10” before “item 2”; natural order, shown above, fixes that. The second example sorts by length: “fig” (3 letters), “kiwi” (4), “apple” (5), “banana” (6).
Why a proper alphabet matters
A naive sort orders characters by their code number. In that order every capital comes before every lowercase letter, so “Zebra” lands above “apple”, and accented letters land after “z”, so “Éclair” ends up at the bottom. This tool uses the browser’s collation rules for the page language instead, the same rules that dictionaries and phone contact lists use.
Common mistakes
- Sorting numbered items with A → Z. “Chapter 10” ends up above “Chapter 2”. Use Natural.
- Leading spaces. A line that starts with a space or a tab sorts before the others. Run remove extra spaces first.
- Empty lines at the top. Blank lines sort first. Remove them with remove empty lines before sorting.
- Expecting duplicates to be removed. Sorting puts duplicates next to each other but keeps all of them. Use remove duplicate lines to delete them.
- Sorting a list that should stay in its order. Numbered steps, rankings and timelines lose their meaning when sorted. Keep a copy before you sort.
Frequently asked questions
How do I sort a list alphabetically?
Paste the list into the box above, one item per line. It is sorted A → Z immediately; click Z → A for the opposite direction. Copy the result back into your document or spreadsheet.
What is natural sort?
Natural sort reads numbers inside lines as numbers, so "item 2" comes before "item 10". A plain alphabetical sort compares character by character and puts "item 10" first, because the character 1 comes before 2. Use natural sort for file names, chapters, versions and anything numbered.
Where do accented letters and capitals go?
Next to their plain letters. "Éclair" sorts between "banana" and "fig", not after "zebra" as it would in a simple character-code sort, and "Apple" and "apple" sort together. The order follows the alphabet rules of the page language.
Is the shuffle really random?
Yes. Shuffle uses the Fisher–Yates algorithm with your browser's cryptographic random generator, so every order of the lines is equally likely. Click Shuffle again for a new order. It is a fair way to randomize a reading list, a team order or a set of quiz questions.
How do I sort lines in Word or Google Docs?
In Word, select the lines and choose Home → Sort (the A–Z icon), then pick Text and Ascending. Google Docs has no built-in line sort; paste the lines into a spreadsheet column and use Data → Sort range, or sort them here.