TT · TEXT TIDY

GUIDE · LISTS

Sorting lines and when ordering helps

Sorting a list alphabetically feels trivial, and for a column of plain words it usually is. But the moment numbers, punctuation, accents or mixed scripts appear, ordering stops being universal. This guide explains what line sorting actually compares and when you are better served by reversing the list instead.

What alphabetical really means

Sorting here uses the ordering rules built into your browser's locale, comparing strings character by character. That produces predictable results for a simple list, but three traps come up constantly:

Sorting is not the only ordering task

Many lists arrive newest-first or in the order things were added, and that order is the point. A journal, a changelog or a reading order should not be alphabetized — it should be reversed at most. Reverse line order exists for exactly these cases: it flips top-to-bottom without touching the content of any line, which preserves a chronological or intentional sequence while letting you read it the other way around.

A sequence that avoids surprises

  1. Confirm one item per line. Sorting operates on whole lines, so a wrapped entry becomes two sorted fragments.
  2. Normalize if the list is mixed. Clean spacing and, if appropriate, a single case conversion make the ordering consistent.
  3. Pick the operation. Sort lines A–Z for lookup lists, Reverse line order for chronological or intentional sequences.
  4. Spot-check the top and bottom. Order errors concentrate at the boundaries — the first and last few lines reveal most problems.

When to sort, when not to

Sort when the list is a lookup: names, titles, identifiers, options in a menu. Do not sort when the list tells a story in time, when rows are paired positionally with content elsewhere, or when the input is prose that merely looks line-based. When in doubt, sort a copy and compare — a wrong sort is easy to make and quiet in its effects, because the content all survives while the meaning quietly shifts.

← All guides