Skip to content
Case Converter Online
en

Sort Alphabetically

Paste a list and put it in alphabetical order, A to Z or Z to A. Numbers inside items sort by value, so item 2 comes before item 10.

Order
Items are separated by
Options
Characters
0
Words
0
Lines
0

Runs in your browser. Your text is never uploaded.

What this alphabetical sorter does

It takes a list and puts it in alphabetical order. You can sort from A to Z, from Z to A, or by length. It works on lines, on single words or on comma separated items, and it handles the cases that trip up simple sorting: capital letters, accented letters and numbers inside text.

Everything happens in your browser. Nothing you paste is sent anywhere.

How to sort a list

  1. Paste your list into Your list. The tool starts with a short example so you can see how it behaves.
  2. Pick an Order: A to Z, Z to A, Shortest first or Longest first.
  3. Tell it how the items are separated: New lines, Commas or Spaces (words).
  4. Switch options on or off. Ignore case, Numbers in number order and Remove blank lines are on by default. Ignore A, An and The and Remove duplicates are off.
  5. Press Copy, or Download to save a text file.

The note under the tool tells you how many items were sorted and how many duplicates were removed.

Examples

This is the example list the tool opens with, sorted with different settings:

Settings Result
Default (A to Z) Apple, banana, cherry, item 2, item 10, mango, The Beatles
Z to A The Beatles, mango, item 10, item 2, cherry, banana, Apple
Ignore A, An and The on Apple, banana, The Beatles, cherry, item 2, item 10, mango
Numbers in number order off Apple, banana, cherry, item 10, item 2, mango, The Beatles

The results are shown here on one line to save space. In the tool they stay one item per line.

A few more:

Input Settings Result
pear, fig, apple, kiwi Commas apple, fig, kiwi, pear
the quick brown fox jumps Spaces (words) brown fox jumps quick the
ccc, a, bb (one per line) Shortest first a, bb, ccc
Zoe, adam, Émile, Eva (one per line) A to Z adam, Émile, Eva, Zoe
b, B, a, b (one per line) Remove duplicates a, b

How the sorting works

The sorter uses the same comparison rules your browser uses for English text, through a feature called Intl.Collator. That gives it a few useful habits.

  • Case does not change the order. “apple” and “Apple” sort together, not in two separate groups. When two items differ only by case, the capitalized one comes first.
  • Accents are treated as their base letter. “Émile” files under E, next to “Eva”, instead of being pushed to the end of the list.
  • Numbers sort by value. With Numbers in number order on, “item 2” comes before “item 10”, and “Chapter 9” before “Chapter 12”. This is often called natural sorting.
  • Articles can be skipped. With Ignore A, An and The on, “The Beatles” sorts as “Beatles”. Only the comparison changes. The item itself is not edited.

When you sort by words, punctuation stuck to the start or end of a word is removed, so “fox.” and “fox” are treated as the same word. When you sort by commas, a semicolon or a line break also counts as a separator.

Remove duplicates keeps the first copy of each item. With Ignore case on, “Banana” and “banana” count as the same item. Turn Ignore case off if they should both stay.

Tips

  • Sorting numbers only? The number sorter is better for a list of plain numbers. It handles negatives and decimals and gives you the sum and average too.
  • Need the list without repeats but in its original order? Use the duplicate line remover instead. It removes repeats without sorting.
  • Want the order flipped later? Choose Z to A, or paste the sorted list into the reverse text generator and pick Line order.
  • Names with surnames. The tool sorts by the first character of each line. To sort “Ada Lovelace” by surname, rewrite the list as “Lovelace, Ada” first. The find and replace tool can do that in one step with a regular expression.
  • Mixed languages. The rules are tuned for English. Lists in other languages still sort sensibly, but a few letters may not land exactly where a native dictionary puts them.

Other ways to sort alphabetically

Microsoft Word. Select the lines, then go to Home and click the Sort button (the A to Z icon with an arrow). Choose Paragraphs and Text, then Ascending. Word sorts each paragraph as one item.

Google Docs. There is no built-in sort. You can install a sorting add-on, or paste the list into Google Sheets, sort it there and paste it back.

Excel and Google Sheets. Put one item per cell in a column, select it, then use Data and Sort A to Z. In a formula, =SORT(A1:A20) returns the sorted list in Google Sheets and in Excel 365. Note that spreadsheets sort “item 10” before “item 2” unless the numbers are in their own column.

Code. In JavaScript, list.sort((a, b) => a.localeCompare(b, 'en', { numeric: true })) gives the same natural order as this tool. In Python, sorted(items, key=str.lower) ignores case, but it does not sort numbers inside text by value.

For a quick list from an email, a chat or a document, pasting it here is usually the fastest way.

Alphabetical Sorter: questions and answers

How do I sort a list alphabetically?

Paste the list into the Your list box with one item per line. The sorted list appears on the right straight away. Choose A to Z or Z to A under Order, then press Copy.

Can I sort words in a sentence or a comma separated list?

Yes. Under Items are separated by, choose Spaces (words) to sort every word, or Commas to sort a list such as pear, fig, apple. The result keeps the same kind of separator.

Why does item 10 come after item 2?

Numbers in number order is switched on, so the digits inside an item are compared by value. Switch it off to get strict character order, where item 10 comes before item 2 because 1 is smaller than 2.

How do I sort names but ignore The at the start?

Switch on Ignore A, An and The. Titles such as The Beatles are then filed under B, the way libraries and music shops do it. The words stay in the result; they are only skipped when comparing.

Does sorting change the text of my items?

No. Items are moved, not edited. Spaces at the start and end of each line are trimmed, and blank lines are removed unless you switch off Remove blank lines.

More text tools

See all tools