Sort, dedupe, and shuffle lines of text

Sort, dedupe, shuffle lines.

Reorder lines alphabetically, numerically, by length, or shuffle. Dedupe, trim whitespace, drop blanks, and reverse the order. Pure browser; no login.

Sorting, cleaning and deduplicating lists

Lists pile up everywhere: email addresses exported from a form, keywords for a campaign, product SKUs, names for a raffle, lines from a log file. Before they are useful they usually need sorting, trimming and de-duplicating, which in a spreadsheet takes several steps and some formula knowledge.

Paste one item per line and this tool sorts the list alphabetically, numerically, by length or in random order, and can remove duplicates, blank lines and stray spaces, and reverse the result.

How to use it

  1. Paste your list with one item per line.
  2. Choose the sort mode: alpha, numeric, length or shuffle.
  3. Tick the clean-up options you need: Dedupe, Trim, Remove blanks and Reverse.
  4. Copy the result from the output box.

Example: a messy shopping list

Input
banana
apple

Cherry
apple
Output
apple
banana
Cherry

With alpha sorting, Dedupe, Trim and Remove blanks switched on, the empty line and the second apple disappear. Cherry sorts after banana despite its capital letter.

Alphabetical or numeric?

Alphabetical sorting compares text character by character, so 10 comes before 9 because 1 comes before 9. Numeric sorting reads each line as a number and orders by value: 2, 9, 10, 100. Lines that are not numbers fall back to alphabetical order among themselves.

The alphabetical mode uses your browser's language-aware comparison, so upper and lower case letters sort together and accented letters sit next to their base letters, the way a dictionary orders them. A strict computer sort by character code would put all capitals first.

How the clean-up options work

Trim removes spaces and tabs at the start and end of each line, which often hide in pasted data and make apple and apple with a trailing space count as two different items. Dedupe keeps the first copy of each line and drops later ones; it compares lines exactly, so switch on Trim first. Remove blanks deletes empty lines, and Reverse flips the final order, for Z to A or largest first.

Shuffle for draws and tests

Shuffle uses the Fisher–Yates method, which gives every possible order the same chance. That makes it suitable for picking a random order of speakers, assigning tasks, or randomising quiz questions. For a public prize draw, record the list and the result, since a shuffle cannot be repeated.

Questions

Is there a limit to the list size?

Lists of tens of thousands of lines sort instantly. Very large files are limited only by your browser's memory.

Can I sort by a column in CSV data?

This tool sorts whole lines. For column sorting, use the CSV tool or a spreadsheet.

Is my list saved anywhere?

No. Sorting happens in your browser and nothing leaves the page.