Sort Lines Alphabetically

Alphabetize lists in ascending or descending order.

Ready.
v1.0
About this tool

Sort Lines Alphabetically

Sort Lines Alphabetically puts any list into A to Z or Z to A order. Paste the list, pick a direction, copy the result.

How to use it

  1. Paste your list, one item per line.
  2. Choose A to Z or Z to A.
  3. Copy the sorted result.

Why sorted output sometimes looks wrong

Naive alphabetical sorting compares character codes, and in that scheme every uppercase letter comes before every lowercase one. Z sorts before a, so a mixed-case list can look shuffled rather than sorted.

Numbers inside text cause the other surprise. Character-by-character comparison puts item10 before item2, because it compares the 1 against the 2 and stops there. That is correct lexicographic ordering and almost never what you wanted.

Worked example

A mixed list sorted by character code:

  • Inputbanana, Apple, cherry, Date
  • ResultApple, Date, banana, cherry

Result: All capitalised entries sort ahead of all lowercase ones, which surprises most people the first time.

When it helps

  • Alphabetising a list of names, tags or references.
  • Putting an import or export file in a predictable order.
  • Making two lists comparable before diffing them.
  • Tidying a bibliography or glossary.

Common mistakes

  • Sorting a list with inconsistent capitalisation and expecting dictionary order.
  • Sorting numbered items and expecting numeric order. Ten will land next to one.
  • Sorting data that has a header line, which gets sorted into the middle with everything else.
Sort Lines Alphabetically interface preview
Screenshot of the live Sort Lines Alphabetically interface.