Sort Lines Alphabetically

Paste a list, one item per line, and sort it A to Z or Z to A. Sort numbers naturally, sort by line length, reverse the list or shuffle it. It runs in your browser and your text is never uploaded.

Your list

Options

Result

Lines in
0
Lines out
0
Blank lines removed
0
Duplicates removed
0

How to sort lines alphabetically

  1. Paste your list into the box, one item per line.
  2. Pick an order: A to Z, Z to A, by length, reversed or shuffled.
  3. Set the options, then press Copy result.

How lines are sorted

Lines are compared with your browser's alphabetical rules, so accented letters sit next to their plain forms. With Natural numbers on, item2 comes before item10, which is what most people expect from a list. Switch to Plain text to compare one character at a time. Ignore case is on by default, so Apple and apple sort together. Sorting by length puts lines of the same length in A to Z order.

Related tools

Clean up a list with the remove duplicate lines tool, change the case of text with the case converter, or count words and lines with the word counter.

See also

Frequently Asked Questions (FAQ)

How do I sort lines alphabetically?

Paste your list into the box, one item per line, and leave the order on A to Z. The sorted list appears straight away. Press Copy result to put it on your clipboard.

How do I sort a list from Z to A?

Choose Z to A under Order. The same list is shown in reverse alphabetical order.

Why does item10 come before item2 in some sorters?

A plain sort compares one character at a time, so 1 comes before 2 and item10 lands before item2. This tool sorts naturally by default, so item2 comes before item10. Switch Numbers to Plain text if you want the character by character order.

Is the sort case sensitive?

Not by default, so Apple and apple sort together. Untick Ignore case to make capital and small letters count as different, so both are kept when removing duplicates.

Can I sort by line length?

Yes. Choose Shortest first or Longest first. Lines of the same length are put in A to Z order.

Can I shuffle or reverse a list?

Yes. Reverse flips the current order of your lines. Shuffle puts them in a random order, and pressing Shuffle again gives a new one.

Can it remove duplicates while sorting?

Yes, tick Remove duplicate lines. For more control, such as keeping the last copy, use the remove duplicate lines tool.

Is my text uploaded?

No. The tool runs in your browser and your text never leaves your device.