Skip to content
Language:en

Sort lines and remove duplicates

Sort a list alphabetically or naturally, remove duplicate and empty lines, shuffle.

Runs entirely in your browser. Your files never leave your device.

About this tool

Paste a list, one item per line, and get it back sorted and cleaned. Sort alphabetically in either direction, in natural order so that “item 2” comes before “item 10”, by line length, in reverse or at random. At the same time, remove duplicate lines, delete blank ones and trim the spaces around each item.

It is the quickest way to tidy up email lists, keywords, product codes, names for a draw or lines copied from a spreadsheet. Sorting follows the alphabet of your language, accents included, and the counters tell you how many duplicates and empty lines were removed.

How it works

  1. Paste your list, one item per line.
  2. Choose a sort order.
  3. Tick the clean-up options you need.
  4. Copy the result, or reuse it as the new input.

Duplicates are compared after trimming when that option is on, and can ignore case. The first occurrence of each line is kept, in its original spelling.

Worked example

A list of 300 email addresses merged from three sign-up sheets, with blank lines and repeats. Tick “remove duplicates”, “remove empty lines” and “trim”, sort A to Z: you get 271 clean, unique addresses and the counters tell you 22 duplicates and 7 empty lines were removed.

File names such as photo2, photo10 and photo1 come out as photo1, photo2, photo10 with natural sort, instead of the photo1, photo10, photo2 order of a plain sort.

Good to know

  • Removing duplicates without sorting keeps the first occurrence of each line in its original place.
  • Shuffle a list of names to set a random speaking order or seating plan.
  • Trim before removing duplicates, otherwise “apple” and “apple ” count as different lines.

Frequently asked questions

What is natural sort?
It compares numbers inside the text by value instead of digit by digit, so file2 comes before file10, as people expect.
Can I remove duplicates without sorting?
Yes. Choose “Keep order” and tick “Remove duplicates”: the list keeps its order and only repeats disappear.
Is the shuffle really random?
It uses an unbiased Fisher–Yates shuffle with your browser’s random generator, fine for picking an order or drawing names.