Sort lines: A to Z, Z to A, by length, numeric, reverse and shuffle

Sort order
Nothing to sort yet. Paste some lines.

About Sort Lines

This tool sorts a list of lines. Paste one item per line, pick an order and the result appears in the Output box as you type. You can sort A to Z, Z to A, by line length, in natural number order, in reverse, or shuffle the lines into a random order.

The options clean the list at the same time. Trim whitespace removes spaces and tabs from the edges of each line, Ignore blank lines drops empty lines, and Remove duplicates keeps only the first copy of each line. Case-sensitive and Locale-aware decide how lines are compared.

Everything runs in your browser. Your text is not sent anywhere.

How to sort lines

  1. Paste or type your lines into the Input box, one item per line.
  2. Choose a sort order and switch on any options you need.
  3. Copy the Output or download it as a .txt file.

Frequently asked questions

How do I sort lines alphabetically?

Paste your lines into the Input box and leave the order on A to Z. The sorted list appears in the Output box straight away. Choose Z to A to flip it. Each line is one item, so put one entry per line.

What is the difference between numeric and A to Z sorting?

A to Z compares letter by letter, so line 10 comes before line 2. Numeric (natural) reads whole numbers inside each line, so line 2 comes before line 10. It also sorts plain numbers, including ones with decimals or leading zeros, in the order you expect.

What does locale-aware sorting do?

With it on, the tool uses your browser's language rules, so accented letters such as é and ö sit next to their plain forms. With it off, lines are compared by their raw character codes, which puts all capitals before all lower case letters and accented letters after z.

How does remove duplicates work?

The first copy of each line is kept and later copies are dropped. If case-sensitive is off, Apple and apple count as the same line. If trim whitespace is on, spaces at the edges are ignored when comparing.

Is the shuffle truly random?

It uses a Fisher-Yates shuffle driven by your browser's secure random number generator, so every order is equally likely. Press Reshuffle for a new order. The order stays put while you change other options.

Is my text sent to a server?

No. Sorting runs entirely in your browser and your text is never uploaded or stored.