Remove Duplicate Lines and Sort

Tidy a list with one item per line: remove repeats and empty lines, trim spaces, and sort it.

Free, no sign-up Your text never leaves your browser

Tidied in your browser. Your list is never sent or saved.

How to remove duplicate lines

  1. Paste your list into the first box, one item per line. It might be email addresses, names, keywords or product codes.
  2. Choose what to tidy: duplicates, empty lines, spaces, and the order. The tidied list updates as you go.
  3. Press "Copy result" and paste it where you need it.

How it works

  • Duplicates: the first time a line appears, it stays; later copies are removed. With "Treat capitals as the same", Apple and apple count as duplicates and the first one is kept as it was typed.
  • Spaces: spaces and tabs at the start and end of each line are removed first, so "apple " and "apple" count as the same line.
  • A to Z: sorts the way people expect rather than the way computers often do: capitals don't come first, accents are ignored, and numbers inside lines are compared as numbers, so "Item 2" comes before "Item 10".
  • Steps happen in this order: spaces, empty lines, duplicates, then sorting.

Worked example

A list of 8 lines, tidied with "Treat capitals as the same" ticked and the order set to A to Z:

Your list Tidied list banana Apple Apple banana item 10 item 2 apple item 10 banana (empty line) item 2 item 10 8 lines in, 4 lines out 3 duplicates removed: apple, the second banana, the second item 10 1 empty line removed

Without "Treat capitals as the same", apple stays, so the tidied list has 5 lines: Apple, apple, banana, item 2, item 10.

Frequently asked questions

Can I see how many duplicates there were?

Yes. The line under the boxes counts the lines before and after, the duplicates removed and the empty lines removed.

How do I tidy a list separated by commas?

Put each item on its own line first. In most spreadsheets, a column copies as one item per line, which is ready to paste here.

Is my list saved or sent anywhere?

No. Everything happens in your browser, and the list is gone when you close or reload the page. That matters for lists of email addresses or customer names: we never see them.

Keep going

Related tools

All Text tools

Please note: these tools change text by fixed rules, so check the result before you use it, especially names, codes and anything legal or official. Read the full disclaimer.

Last updated: