Skip to content
QuickKit 100% free · no login

Home › Text Tools › Sort Lines Alphabetically

Sort Lines Alphabetically (and More)

Runs in your browserFree · no sign-up

Paste a list with one item per line, pick how to sort, and copy the result. Optional clean-up removes blank lines and duplicates.

Advertisement

Sorting a list of lines

Sorting a list by hand is slow and error-prone, whether it is a set of names, keywords, tags, file names or lines of configuration. This tool takes any text with one item per line and rearranges the lines in the order you choose. It does what the sort command or a spreadsheet's sort button does, with no setup and nothing to install, and you can combine it with simple clean-up steps.

The sort orders

  • A to Z and Z to A: plain alphabetical order based on character codes. With "Ignore case" on, capital and small letters are treated alike, which is what people usually expect from an alphabetical list.
  • Natural: treats embedded numbers as numbers, so item2 comes before item10. Plain alphabetical order would put item10 first because "1" comes before "2".
  • Numeric: sorts by the number at the start of each line, ignoring text after it. Lines with no number go to the end.
  • By length: shortest lines first, with ties sorted alphabetically.
  • Reverse: flips the existing order without sorting.
  • Shuffle: random order using a secure random source, useful for quizzes, playlists or draw order. Press Re-run to shuffle again.

Clean-up options

"Trim spaces" removes leading and trailing whitespace on each line, which prevents " apple" from sorting before "apple". "Remove blank lines" drops empty lines. "Remove duplicates" keeps the first occurrence of each line, and respects the case setting: with it on, "Apple" and "apple" are treated as the same line. These steps run before sorting, so the count shown in the result reflects the final list.

Limitations

Alphabetical sorting here is simple and does not follow language-specific rules, so accented letters such as é may sort after z in A to Z mode. Natural order uses your browser's locale-aware comparison, which handles accents better. For very large lists of hundreds of thousands of lines, a command-line tool will be faster. The tool runs in your browser, and your list is not uploaded.

Frequently asked questions

How do I alphabetize a list online?

Paste the list with one item per line, choose A → Z and copy the result.

Why does item10 come before item2?

Alphabetical sorting compares character by character, and "1" is before "2". Choose "Natural" to sort numbers inside text correctly.

Can I remove duplicates while sorting?

Yes. Tick "Remove duplicates" and the first occurrence of each line is kept.

Is the shuffle random?

Yes. It uses the browser’s secure random generator with an unbiased Fisher–Yates shuffle.

Does it change my original text?

No. The result appears in a separate box and your input stays as it is.

More free tools