TEXT TOOL

Duplicate Line Remover

Paste a list and remove duplicate lines, keeping the first occurrence of each.

About this tool

The Duplicate Line Remover treats your text as a list, one item per line, and keeps only the first appearance of each distinct line. It is handy for email lists, keyword lists, product codes, tags, or any pasted column where each entry should appear once. Everything runs in your browser; the list is never sent anywhere.

How to use the Duplicate Line Remover

  1. Paste your list, one item per line.
  2. Set your options — ignore case, trim whitespace, or sort alphabetically.
  3. Click "Remove duplicates" and copy the cleaned-up result.

How lines are matched

The tool splits your text at each line break and reads the lines from top to bottom, remembering every line it has already seen. A line that matches an earlier one is dropped; anything new is kept. Matching is exact, character for character, after your options are applied:

Without sorting, the surviving lines stay in their original order. The count above the result is the number of unique non-empty lines; a kept blank line isn't counted.

Worked example

Suppose you've combined signups from two forms into this nine-line list. The fourth line starts with two spaces, the sixth has a trailing space after the address, and there are two blank lines:

Jane@Example.com
omar@example.com
jane@example.com
  lee@example.com

omar@example.com 
Lee@example.com

zoe@example.com

With only the default Trim whitespace option on, the tool reports 6 unique lines. The second omar@example.com is removed once its trailing space is trimmed, and the second blank line goes too, but Jane@Example.com and jane@example.com both survive, as do lee@ and Lee@, because their capitalisation differs. Turn on Ignore case as well and the count drops to 4:

Jane@Example.com
omar@example.com
lee@example.com

zoe@example.com

Adding Sort alphabetically gives the same four addresses in A–Z order, with the one remaining blank line moved to the very top, since an empty line sorts before any text.

A note on case and email addresses

Ignore case is usually the right choice for email lists, but it is a convention rather than a rule. Domain names are not case-sensitive, while the email standard RFC 5321 says the part before the @ must be treated as case-sensitive — though it also discourages anyone from relying on that. In practice most mail services treat Jane@ and jane@ as the same mailbox, so merging them avoids sending the same message twice. For data where case really does matter, such as product codes where ab12 and AB12 are different items or file paths on Linux, leave Ignore case off.

Common use cases

Edge cases and limits

When to use another tool

If you want to de-duplicate and sort in one pass with more control over the order — natural order (file2 before file10), by number, by length, or Z–A — the Text Sorter has a remove-duplicates option alongside its sort modes. To remove blank lines and extra spaces entirely rather than collapsing them, use the Text Cleaner.

When identical-looking lines are both kept

The tool compares characters, not appearance, so two lines that look the same on screen can still be different underneath. We tested the common causes against the tool's own matching rules:

Limits of Ignore case

Ignore case works by converting each line to lowercase with your browser's standard rules before comparing. That handles almost every everyday list, but a few letters do not have simple one-to-one pairs. The German ß stays ß in lowercase, so STRASSE and straße are not matched. The Turkish capital İ (with a dot) lowercases to two characters, an i plus a combining dot, so it does not match a plain i. If your list is in a language with these letters, check the result by eye.

Removing duplicate words rather than lines

The tool only compares whole lines, so repeated words inside one sentence or a comma-separated list are not touched. To deduplicate words, first put each word or item on its own line. Most text editors and spreadsheet programs can replace commas or spaces with line breaks. Then paste the list here, remove duplicates, and join the items again if you need them on one line. Keep Trim whitespace on so the spaces left over from the commas are ignored.

Seeing how many duplicates were removed

The result shows the number of unique lines, not the number removed. To get the removed count, count the lines you pasted and subtract the unique count. Remember that blank lines are included in your input but not in the unique total. To see exactly which lines disappeared, paste the original and the result into the Text Diff Checker.

Frequently asked questions

Which occurrence of a duplicate does the tool keep?

The first occurrence of each unique line is kept, and later duplicates are removed — the original order is otherwise preserved unless you enable alphabetical sorting.

What does "Ignore case" do?

With it enabled, "Apple" and "apple" are treated as the same line and only the first is kept. With it off, they're treated as different lines and both are kept.

Will empty lines be counted as duplicates?

Yes — multiple blank lines are treated like any other repeated value, so only the first blank line is kept unless you remove them manually beforehand.

Does "Trim whitespace" change the lines in my result?

Yes — when it's on, leading and trailing spaces and tabs are removed from every line in the output, not just for the comparison. Turn it off if you need to keep indentation, but then lines that differ only by a trailing space won't be treated as duplicates.

Can this tool show duplicates without deleting them?

Not directly. It always outputs the list with repeats removed. To find out which lines were duplicates, run the list through once, then compare the original with the result in a text diff tool. Every line missing from the result was a repeat of an earlier line.

Is there a limit on how long my list can be?

The code sets no line limit. The whole list is processed in your browser, so the practical limit is your device's memory and how well the text box copes with a very large paste. Each line is checked once against a record of lines already seen.

Why does a line with an accented letter not match the same word?

Unicode lets an accented letter be stored either as one character or as a plain letter followed by a combining accent mark. Both look identical, but the tool compares characters exactly and does not normalize them, so the two versions are treated as different lines.