Duplicate Line Remover

Paste one entry per line — email addresses, URLs, order numbers, names, keywords — and this tool removes the repeats while keeping the first occurrence of each line in its original position. You decide how strictly “duplicate” is judged.

Remove duplicate lines

Duplicate rules

Tip: results update as you type and as you change the rules. Press Ctrl+Enter to re-run and jump to the result.

  • 0Input lines
  • 0Unique lines
  • 0Duplicates removed

The rules, stated precisely

Ambiguity is the main source of bugs in de-duplication, so here is the exact behaviour this tool implements.

Behaviour of each control
Control Default Exact effect
Comparison unit Whole line Lines are compared as complete strings. Substrings, individual words and CSV fields inside a line are never compared or split.
Which occurrence survives First The first occurrence is kept in place; later identical lines are dropped. Order of the survivors matches the input, unless you choose a sort order.
Ignore leading/trailing whitespace On Each line is trimmed of spaces, tabs and non-breaking spaces before comparison, and the trimmed form is written to the output.
Ignore letter case Off Off: Apple and apple are different lines, which matters for case-sensitive IDs and codes. On: they are duplicates, and the first spelling encountered is kept.
Also remove blank lines Off Off: empty lines are still de-duplicated, so a run of four blank lines becomes one. On: every blank line is deleted.
Interior whitespace Untouched Spaces inside a line are preserved exactly. “New  York” is not the same line as “New York”.
Sorting Off Sorting happens after de-duplication. It uses locale-aware, numerically natural ordering, so item2 sorts before item10.

A worked example

Input:

  apple
banana
apple
Cherry
banana
   

With the default settings the first apple (including its leading spaces) and the first banana are kept, the later copies are removed, Cherry stays because case is significant, and the trailing whitespace-only line becomes one blank line. The result is four lines: apple, banana, Cherry and one empty line. Switching Ignore letter case on and Also remove blank lines on gives exactly three lines.

Typical uses

  • Deduplicating a mailing list exported from two systems before an import.
  • Cleaning up a keyword or tag list that has grown repeats over time.
  • Reducing a log extract to the distinct error messages it contains.
  • Collapsing a URL list scraped from a sitemap and a crawl of the same site.

Check the counts. The three figures under the tool tell you how many lines went in, how many came out and how many were discarded. If the number removed looks wrong, change Ignore letter case — it is the setting that most often causes surprises.

Related tasks

If you also need to fix inconsistent spacing around the lines, run the list through the text formatter first, then de-duplicate. To see how many entries survived, use the word counter: its line count reflects exactly what is in the box.

Frequently asked questions

Does it keep the original order of the lines?
Yes. By default the first occurrence of each line is kept and the rest are removed, so the surviving lines stay in the order they first appeared. Sorting only happens if you explicitly ask for it.
Is it case sensitive?
You choose. With case sensitivity off, “Apple” and “apple” count as the same line and the first spelling is the one kept. With it on, they are treated as two different lines.
Does it ignore leading and trailing spaces when comparing lines?
Yes, when whitespace trimming is enabled. That is usually what you want, because a stray trailing space otherwise makes two identical-looking lines count as different. Turn it off when leading indentation is meaningful.
How do I remove duplicate lines in Excel or Google Sheets?
Copy the whole column, paste it into the box above, remove the duplicates, then copy the result back into your sheet. It works the same way for any spreadsheet, database export or CSV, and nothing is uploaded.
Can I also remove blank lines and sort the result?
Yes, both are options on this page. Blank-line removal deletes empty and whitespace-only lines, and sorting can be alphabetical, reverse alphabetical or by line length. Each is independent of the de-duplication step, so you can apply any combination.
Is there a limit on how many lines I can paste?
No server-side limit, because the list never leaves your browser. The practical ceiling is your own memory; lists of tens of thousands of lines are handled without trouble.