TextJanitor

Sort Lines

Paste a list and sort it alphabetically, naturally, by number or by length, reverse it, or shuffle it at random.

Lines in
0
Lines out
0

Working…

Your text is processed in your browser and is never uploaded or stored on our servers.

How to use the Sort Lines

  1. 1 Paste your lines into the box, one item per line.
  2. 2 Pick a sort order from the list. The sorted lines appear straight away.
  3. 3 Adjust the options: ignore case, ignore surrounding spaces, drop empty lines or duplicates.
  4. 4 Copy the sorted lines or download them as a .txt file.

Nine ways to order a list

Alphabetical sorting is the default, but lists are rarely only words. This tool sorts A to Z or Z to A, naturally, numerically, by length in either direction, reverses the order, or shuffles it. Every option works line by line and shows how many lines went in and came out, so you can see at a glance whether blank lines or duplicates were dropped.

Natural sorting

A plain alphabetical sort compares text one character at a time, so "item 10" lands before "item 2" because 1 comes before 2. Natural sorting reads digit groups as whole numbers, which is what people expect from file names, version labels and numbered lists.

Before

item 10 item 2 item 1

After

item 1 item 2 item 10

Numeric sorting

Numeric sorting finds the first number in each line and orders by that value, so prices, scores and quantities line up correctly even when they sit inside other text. Commas in numbers such as 1,500 are understood, and negative numbers and decimals work too. Lines without any number are placed at the end, in their original order.

Language-aware sorting

Alphabets differ. Accented letters should sit next to their plain version in French or Spanish, while in some languages a letter like ä sorts after z. With language-aware sorting on, your browser applies the rules of its own language. Turn it off for a fixed, simple ordering that does not depend on the language of the device.

Stable results and shuffling

When two lines are equal for the chosen order, they keep their original relative order, so repeated sorts never scramble ties. Shuffle uses your browser's secure random number generator, so every ordering is equally likely, and you can reshuffle as often as you like.

Tips

Sort first and tidy later: if the list has repeats, tick Remove duplicate lines, or use the dedicated duplicate line remover when you also want counts. Lines pasted from a PDF may need the line break cleaner before they sort sensibly.

Frequently asked questions

What is the difference between natural and alphabetical sorting?

Alphabetical sorting compares characters one by one, so "item 10" comes before "item 2". Natural sorting treats digit groups as numbers, so "item 2" comes before "item 10".

How does numeric sorting handle lines with no number?

The first number found in each line is used for ordering. Lines without a number are placed after all the others and keep their original order.

Is the shuffle really random?

It uses your browser's secure random number generator and a standard shuffling method, so every possible order is equally likely.

Will equal lines swap places?

No. When two lines tie for the chosen order, they stay in the order they had in your list.

Can I sort case-sensitively?

Yes. Untick "Ignore case". Lowercase and uppercase versions of the same letter are then treated as different, though they still sit close together in language-aware mode.

Is my text sent to a server?

No. Sorting happens entirely in your browser and your lines never leave your device.