Skip to content
HandfulTools

How to sort a list alphabetically

Put a list in alphabetical order online, why 10 sorts before 2 in most tools, how accented letters and case are handled, and how to sort in Excel or Word instead.

· 6 min read

Sorting a list alphabetically means putting one item on each line and letting the computer compare them. It sounds trivial until the list holds Item 10, Item 2, Ángel, ángel and trailing space — at which point three reasonable tools give three different answers, all of them defensible.

The quickest route here: paste your list into Sort Lines, one item per line. The default order is A → Z (natural: 2 before 10), which is almost always the one people want. The result appears as you type and can be copied straight out. The text stays in your browser, so a customer list or a set of names is not uploaded anywhere.

Which order you actually want

Order What it does Use it for
A → Z (natural) Reads digits as numbers: Item 2 before Item 10 File names, chapters, anything numbered
A → Z (strict) Compares character by character: Item 10 before Item 2 Matching the order another system produced
Z → A Reverse alphabetical Newest-first lists, descending rankings
By first number Ignores the words, sorts on the first number in the line Prices, scores, quantities with labels
Shortest / longest first Sorts by length Finding outliers, tidying keyword lists
Reverse order Flips the list without sorting it Undoing a reversed paste
Random shuffle No order at all Draws, randomising a question list

Natural order is the one that surprises people the least. Strict alphabetical comparison looks at 1, then 0, and decides that Item 10 comes before Item 2 because 0 is less than 2. That is correct character-by-character and wrong for a human reading a list of chapters. Natural order spots the digits and compares them as numbers.

Case, accents and the things that break a sort

  • Case. With Case sensitive off, apple and Apple sort next to each other, which is what a reader expects. With it on, every capital letter comes before every lower-case one, so Zebra lands before apple. Leave it off unless you are matching another system's output.
  • Accents. Sorting follows the conventions of the language you are reading the page in, so ángel sorts next to angel in Spanish and French rather than being banished to the end of the list. That is almost always right; it is also why the same list can come out slightly differently in another language.
  • Leading spaces. A line that starts with a space sorts before every letter, so one stray space sends an entry to the top. Remove Extra Spaces clears them before you sort.
  • Empty lines. Leave Remove empty lines ticked and they disappear. Untick it and you keep them, which matters if the blank lines are separating groups you want to preserve.
  • Numbers inside text. Invoice 9 and Invoice 10 sort correctly in natural order. 2026-03-09 and 2026-03-10 sort correctly in any order, because the dates are already written widest-unit-first — which is the real argument for that date format.

Sorting in Excel, Word and Google Docs

Excel. Click any cell in the column, then Data → Sort A to Z. Excel expands the selection to the surrounding rows so that the other columns follow — check the dialog before you accept it, because sorting one column alone silently detaches it from the rest of the table. For a list in a single column with no neighbours, there is nothing to get wrong.

Word. Select the list, then Home → Sort (the A-Z icon in the Paragraph group) and choose Ascending. Word sorts by paragraph, so a bulleted or numbered list sorts as you would expect.

Google Docs. There is no built-in sort for a list. The usual answers are a Docs add-on, or copying the list out, sorting it elsewhere and pasting it back — which a browser tool does in two clicks.

Google Sheets. Select the range, then Data → Sort range, and tick Data has header row if it does.

Before you sort: clean, then deduplicate

Three steps in this order save most of the trouble:

  1. Clean. Text Cleaner straightens quotes, strips invisible characters and normalises spacing — all of which otherwise change where a line lands.
  2. Remove duplicates. Remove Duplicate Lines collapses repeats, optionally ignoring case so that Paris and paris count as one.
  3. Sort.

Doing it the other way round works too, but duplicates are much easier to spot once they are adjacent — which is itself a reason to sort a list you are about to check by hand.

Comparing two sorted lists

Sorting is often a step towards a different question: what is in one list and not the other. Two lists with the same entries in a different order look completely different to a comparison tool, so sort both with the same settings first, then put them side by side in Text Compare (Diff Checker). What is left highlighted is the genuine difference — the three names that were added and the one that was removed.

Common problems, and what they mean

10 comes before 2. You are in strict alphabetical order. Switch to natural.

One entry is stuck at the top. It starts with a space, a tab or a punctuation mark. Clean the list first.

Capitals are all grouped together. Case sensitive is on. Turn it off.

Accented words are at the end. That happens in tools that sort by raw character codes. This one follows the reading conventions of the page's language instead.

The list lost its grouping. Blank lines were removed. Untick Remove empty lines and sort again — though note that sorting a grouped list mixes the groups together anyway; sort each group separately if the grouping matters.

My list is one long line with commas. Replace the commas with line breaks first — most editors do this with a find-and-replace — because every tool here works a line at a time.

Questions people ask

Can it sort by last name when the list is "First Last"? Not directly. Alphabetical order looks at the start of the line. Put the surname first (Last, First), sort, and swap back if you need to.

Does it sort numbers correctly? In natural order and in By first number, yes. In strict alphabetical order, numbers sort as text, which is where 10 before 2 comes from.

How long a list can it handle? Long ones — tens of thousands of lines are fine, since the sorting happens on your own device. Very large lists are limited by memory rather than by any rule.

Is my list uploaded? No. The sorting runs in your browser, so names, e-mail addresses and customer lists stay on your device.

Can I sort a column of a spreadsheet here? Copy the column, paste it in, sort, paste it back. For a table where the other columns must follow, sort in the spreadsheet instead.

Why does the same list sort differently in another tool? Almost always one of three things: natural against strict order, case sensitivity, or how accents are treated. All three are choices, not bugs.

Next steps

Tools used in this guide

← All guides