English

Sort Lines — Alphabetical and Numeric Sorter

Sort or shuffle lines with natural number ordering

Runs in your browser · nothing is uploaded

0 lines → 0 lines (0 removed)

What it is

This line sorter puts a list, one item per line, in the order you want. Alphabetize names, put file names in numeric order, sort by line length, or shuffle a list to make a random order. It can also remove duplicate and empty lines, and it shows how many lines went in and came out.

How to use

  1. Paste your list into the input box, one item per line.
  2. Choose how to sort: Alphabetical, Length or Random shuffle.
  3. Set options. Reverse sorts descending, Natural number order compares digits by value, and Ignore case and Ignore spaces change how lines are compared.
  4. Turn on Remove duplicate lines or Remove empty lines if you need them.
  5. Copy the result. In random mode, use Shuffle again for a new order.

How it works

  • Alphabetical uses Intl.Collator with this page’s language. Lines are Unicode NFC-normalized before comparing.
  • Natural number order is the collator’s numeric option: consecutive digits are compared as one number.
  • Ignore case treats upper and lower case as equal and keeps the input order for lines that tie. With it off, lowercase comes before uppercase for the same letter.
  • Length sorts by the number of Unicode characters and breaks ties alphabetically.
  • Reverse flips the comparison. The sort is stable, so identical lines keep their input order.
  • Remove duplicates keeps the first occurrence before sorting.
  • Remove empty lines drops blank lines, including lines that contain only spaces or tabs, before sorting.
  • Random shuffle uses crypto.getRandomValues for an unbiased Fisher-Yates shuffle.

Examples

Input Options Result
pear, Apple, banana Alphabetical, ignore case Apple, banana, pear
file10, file2, file1 Default file1, file10, file2
file10, file2, file1 Natural number order file1, file2, file10
ccc, a, bb Length, reverse ccc, bb, a
다람쥐, 가방, 나비 Alphabetical (Korean) 가방, 나비, 다람쥐

FAQ

What is natural number sorting?

It compares runs of digits by value. With it off, file10 comes before file2. With it on, you get file1, file2, file10.

Is the sort language-aware?

Yes. Lines are compared with the browser's Intl.Collator using this page's language, so accented letters and other scripts sort the way a dictionary would rather than by character code.

How random is the shuffle?

It uses the browser's cryptographic random number generator (crypto.getRandomValues) with a Fisher-Yates shuffle and unbiased range selection. The order changes only when you press Shuffle again, not when you toggle other options.

Are my lines uploaded?

No. Sorting happens entirely in your browser.

Missing a tool?