Skip to content
CleanGlyph home

Remove Duplicate Lines

Remove repeated lines from lists and line-based text without changing their order. Exact matching is on by default; case and whitespace are only ignored when you choose.

Your text never leaves your browser.

0 lines · 0 non-empty · 0 charactersAnalyzed as you type

Duplicate options

Only exactly identical lines are treated as duplicates.

Matching
Whitespace

Whitespace must match exactly. "apple" and " apple" are different lines.

Apple, apple and APPLE count as the same line. The kept line keeps its capitalization.

Blank or whitespace-only lines are never treated as duplicates and are kept unless Remove blank lines from output is on.

Keep
Occurrence to keep

Keep the first copy of each line and remove later repeats.

Output

When off, kept lines are written with the whitespace rule above applied. Case is never changed.

Drop every blank or whitespace-only line. Counted separately from duplicates.

How duplicate lines are matched

Every line is compared with the lines before it. Matching options only change how lines are compared; the line that is kept is written exactly as it appeared in your input unless you turn off Keep lines exactly as written. Lines are never sorted, Unicode is never normalized and line breaks in the result are written as LF.

  • Exact match

    The default. Lines must be identical, including spaces, case and invisible characters.

  • Ignore outer whitespace

    Leading and trailing spaces, tabs and NBSP are ignored, so " apple" matches "apple". Inner whitespace still matters.

  • Ignore whitespace differences

    Runs of spaces, tabs, NBSP or other Unicode whitespace inside a line also count as a single space.

  • Ignore case

    Apple, apple and APPLE match. The kept copy keeps its own capitalization.

Keep the first or last occurrence

For the lines A, B, A, keeping the first occurrence gives A, B. Keeping the last occurrence gives B, A, because the surviving A is the copy on line 3 and it stays in that position.

Unicode and invisible characters

This tool does not normalize Unicode. A precomposed é and an e followed by a combining accent look the same but are different lines here, and a line with a hidden zero width space is not a duplicate of one without it. Fix those first with the Text Cleaner or the Zero Width Space Remover, find hidden characters with the Invisible Character Detector, or compare two versions with the Text Difference Checker.

Frequently asked questions

How do I remove duplicate lines from text?

Paste your text into the input box. Each line is compared with the others and every repeated line after the first is removed as you type. Copy the deduplicated text from the result box. By default only lines that are exactly identical count as duplicates.

Does this keep the original order?

Yes. Lines are never sorted. Each retained line stays in the position where it appeared in your input, and only the extra copies are removed. The only exception is an optional Keep last setting that moves each kept copy up to where that line first appeared.

Can I remove duplicates ignoring capitalization?

Yes. Turn on Ignore case and lines such as Apple, apple and APPLE are treated as the same line. The retained line keeps its original capitalization.

Can I ignore spaces when checking duplicates?

Yes. Ignore outer whitespace compares lines without their leading and trailing spaces, tabs and NBSP, while whitespace inside a line must still match. Ignore whitespace differences also treats any run of spaces, tabs, NBSP or other Unicode whitespace inside a line as a single space. Both only affect matching. Invisible format characters such as zero width spaces are not whitespace and are never ignored.

Does this trim or change my text?

No. By default the retained lines are written exactly as they appeared, including spaces, tabs, capitalization, punctuation and invisible characters. Comparison options only decide which lines count as duplicates. Unicode is not normalized. Output line breaks are written as LF, so CRLF and CR input becomes LF.

What is the difference between keeping the first and last occurrence?

It decides which copy of a duplicated line survives. Keep first retains the earliest copy. Keep last retains the latest copy, so for A, B, A the result is B, A because the surviving A is the one on line 3.

Does it remove blank lines?

Only repeated blank lines, because with exact matching an empty line is a duplicate of an earlier empty line. Turn on Ignore blank lines to keep every blank line, or Remove blank lines from output to drop them all. Blank lines removed that way are counted separately from duplicates.

Is my text uploaded?

No. Deduplication runs entirely in your browser. Your text is not sent to a server, stored, put in the address bar or included in analytics.