Sort lines

Paste any list - names, words, file names, numbers - and sort it alphabetically, by length or in natural order, reverse it or shuffle it at random.

Order

Lines: 6

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Paste the list into the left box, one item per line.
  2. Choose the order. The sorted list appears on the right at once.
  3. Press Copy. In shuffle mode, Shuffle again gives a new random order.

How it works

Sorting uses the browser’s Intl.Collator with the rules of this page’s language - the same rules as dictionaries and phone contacts, not raw character codes. Accented letters sit next to their base letter, and case does not split the list in two. Lines that compare equal keep their original order.

Natural order switches on numeric comparison, so digits inside lines are read as whole numbers: “2” < “10”. By length puts the shortest lines first. Reverse order does not sort at all: it just turns the list upside down. Shuffle makes a random order with the Fisher–Yates method.

Worked example

The sample list sorted A → Z gives apple, Banana, cherry, file1.txt, file10.txt, file2.txt. In natural order the files come as file1.txt, file2.txt, file10.txt.

Tips

Sorting is a quick way to spot duplicates, since equal lines end up next to each other; to delete them, use remove duplicate lines. Empty lines are removed by default - turn the option off if you need them, and they will gather at the top.

Frequently asked questions

Why is "file10" before "file2" in A → Z order?

Alphabetical order compares text character by character, and "1" comes before "2". Choose "Natural (1, 2, 10)" to read runs of digits as numbers, so file1, file2, file10 come in that order.

Are capital letters sorted separately?

No. Sorting follows dictionary order, so "apple" and "Banana" sort as a and b; case only decides between lines that are otherwise equal.

How is the shuffle made?

In your browser, with the Fisher–Yates method, so every order is equally likely. Press "Shuffle again" for a new order. It is fine for picking turns or mixing a list, but not for lotteries where the result must be provable.

How is "By length" counted?

By the number of visible characters in each line, so an emoji counts as one. Lines of the same length are sorted A → Z.

More in Text

All tools in this category: Text ·Updated November 3, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.