Guide

How to Sort a List Alphabetically (A to Z or Z to A)

Sorting a list by hand gets tedious after a dozen items. An online line sorter puts any list in order instantly — but there are a few details worth knowing about how text sorting works.

How line sorting works

Each line of your text is treated as one item. The sorter compares items letter by letter and puts them in A-to-Z order, or Z-to-A if you choose descending.

Uppercase and lowercase

Basic computer sorting puts all capital letters before lowercase ones, so "Zebra" lands before "apple". This sorter ignores letter case and accents when comparing, so the order matches what people expect.

Numbers in text: natural sorting

Plain alphabetical sorting puts item10 before item2, because it compares the character 1 with 2. This sorter is number-aware, so it gives item2, item10 — the natural order for file names, chapters and versions.

Worked example

item10, item2, item2 (one per line) sorts to item2, item2, item10. Duplicates are kept; to remove them, run the result through Remove Duplicate Lines.

Tips

A few things to keep in mind:

  • Blank lines are kept and sort to the top
  • Leading spaces affect order — use the Whitespace Cleaner first
  • To sort by last name, put the last name first on each line

Try it yourself

Put this guide into practice with our free Text Line Sorter — no sign-up, no download.

Open the Text Line Sorter