Remove Duplicate Lines and Sort Lines Online

Remove duplicate lines, delete empty lines and sort a list alphabetically, naturally or by length. Paste a list and copy the clean result. Free and private.

Runs in your browser. Nothing you enter is sent to a server.

How to use

  1. Paste your list into the input box, one item per line.
  2. Tick the options you need, such as removing duplicates or empty lines. Decide whether letter case and extra spaces should matter when lines are compared.
  3. Pick a sort order, or keep the original order.
  4. Check the summary under the result to see how many lines were removed, then copy the result.

What this tool is for

Lists pile up duplicates quickly: email addresses exported from two systems, keywords collected from several reports, product codes copied from invoices, or names gathered from a sign-up sheet. Removing duplicates by eye is unreliable, and spreadsheet functions can be overkill for a quick clean-up. Paste the list here and the tool removes repeated lines, drops blank lines and sorts what is left in one step.

Options explained

  • Remove duplicate lines keeps the first occurrence of each line and removes later copies.
  • Ignore case when comparing treats upper and lower case letters as the same during the duplicate check.
  • Ignore leading and trailing spaces treats “ apple” and “apple “ as the same line. This is on by default because stray spaces are the most common reason duplicates slip through.
  • Remove empty lines deletes blank lines and lines containing only whitespace.
  • Sort orders the result A to Z, Z to A, naturally, or by length from the shortest line to the longest.

The steps always run in the same order: empty lines are removed first, then duplicates, then the list is sorted. The summary under the result reports how many lines went in, how many came out, and how many were removed at each step.

Example

Suppose you paste:

banana
Apple
apple
cherry

banana

With duplicates removed, case ignored, empty lines removed and A to Z sorting, the result is “Apple”, “banana” and “cherry” on three lines. The summary shows 6 lines in, 3 lines out, 2 duplicates and 1 empty line removed.

Tips

Clean up invisible characters first if a duplicate refuses to disappear. Text copied from web pages may contain non-breaking spaces or zero-width characters that make two lines look identical while being different underneath. The whitespace cleaner removes these, after which the duplicate check works as expected.

Frequently asked questions

Which copy of a duplicate line is kept?
The first one. Later lines that match it are removed, and the remaining lines keep their original order unless you also choose a sort.
What does "ignore case" do?
When it is on, "Apple", "apple" and "APPLE" count as the same line, and only the first one is kept exactly as it was written.
What is natural sort?
Natural sort compares numbers inside text by their value. A normal alphabetical sort puts "file10" before "file2" because it compares character by character; natural sort puts "file2" first, the way a person would.
How does sorting handle Korean and accented letters?
Sorting uses your browser's language-aware comparison, so Korean is sorted in dictionary order (가, 나, 다) and accented letters sit next to their base letter instead of after "z".
Are lines with only spaces treated as empty?
Yes. When Remove empty lines is on, a line that contains only spaces or tabs is removed as well.
Is there a limit on the number of lines?
There is no fixed limit. Lists with tens of thousands of lines work in a modern browser; very large files may take a moment.