TanodTools

Sort lines alphabetically

Paste a list, one item per line, and get it back sorted A to Z, Z to A, in natural number order, by length or shuffled.

Runs entirely in your browser

Order

Paste lines to begin.

Text up to about 5 MB. The result updates as you type; very long lists update a moment after you stop typing.

How to sort lines alphabetically

  1. Paste your list into the box, one item per line, or open a .txt file.
  2. Choose how to sort and which way: A to Z or Z to A. Tick the clean-up options you want.
  3. Copy the sorted list or download it as a .txt file.

Putting a list in alphabetical order

Each line of the input is one item. The tool sorts the lines and shows the result next to the input as you type, so you can try a different order or option and see the effect straight away. Lines are compared whole, from the first character, so a list of names sorts by first name unless the surname comes first on each line.

Alphabetical sorting uses your browser's language rules, which handle accents and mixed case sensibly. Natural order is best for anything with numbers in it, such as file names, chapter titles or version numbers. Character code order matches what many programming tools and spreadsheets do with a plain sort: every capital letter comes before every lower-case one.

When two lines compare as equal, for example "Apple" and "apple" with Ignore case on, they stay in the order they were in, so sorting twice gives the same result.

Tips

  • Strip numbering or bullet characters before sorting with Find and replace, so they don't decide the order.
  • Check what changed between two versions of a list with Compare text.
  • Need the list on one line again? Use Remove line breaks with a comma as the separator.

Questions

How are accented letters and other languages sorted?

Lines are compared with your browser's language-aware sorting rules, so é sorts next to e and Ä next to A rather than after Z. The order follows the language your browser is set to, which matters for a few letters: in Swedish, for example, Ä comes after Z.

What is natural sort?

Natural sort reads runs of digits as numbers, so "item 2" comes before "item 10". Plain alphabetical order compares one character at a time and puts "item 10" first, because 1 comes before 2.

What does Ignore case do?

With Ignore case on, "apple" and "Apple" are treated as the same word for sorting, and lines that differ only in case keep their original order. With it off, lower-case comes before upper-case when the letters are otherwise equal. Character code order is different again: it puts all capital letters before all lower-case ones, the way many programs do.

Can I remove duplicates while sorting?

Yes. Tick Remove duplicate lines and only the first copy of each line is kept. When Ignore case is on, lines that differ only in capitals count as duplicates. For more control, such as keeping the last copy, use Remove duplicate lines.

How random is the shuffle?

The shuffle uses your browser's cryptographic random number generator with the Fisher-Yates method, so every order is equally likely. Press Shuffle again for a new order.

Is my list uploaded?

No. The sorting runs in your browser, and the text is not uploaded or stored.