Duplicate Line Remover

Remove duplicate lines from any text, ignoring case and whitespace. Keep the first or last occurrence and see which lines repeated.

All processing happens in your browser. Your text never leaves your device.

Paste some text above to get started.

How It Works

Splitting your input into lines and comparing them is a classic set problem, and this tool solves it in one pass. Each line is read in order, normalized by the rules you choose, and looked up in a hash map that remembers whether it has been seen and how many times.

Normalization
Before comparing, a line is optionally transformed: lowercased (ignore case) and/or stripped of leading and trailing whitespace (ignore whitespace). The comparison key is the normalized form, but the original line text is what survives in the output.
First or last
'Keep first' marks a line as a duplicate the moment its key reappears. 'Keep last' keeps overwriting the stored position, so only the final occurrence is kept in the end. Both strategies preserve the relative order of the lines that remain.
Statistics
Every removed line is counted per unique key, which gives you the duplicates list with occurrence counts (capped at 50 entries) and the savings percentage: duplicates removed divided by the original line count.

Frequently Asked Questions

Is my text uploaded anywhere?

No. All processing happens in your browser using plain JavaScript. The text never leaves your device, and nothing is stored or transmitted after you leave the page.

What does 'Keep first' versus 'Keep last' mean?

When a line appears several times, the tool must decide which copy to keep. 'Keep first' preserves the first occurrence and drops the rest; 'Keep last' drops everything before the final occurrence and keeps that one. Both options preserve the original order of the surviving lines.

How do the 'ignore case' and 'ignore whitespace' options work?

With 'ignore case' enabled, 'Apple' and 'apple' count as the same line. With 'ignore whitespace' enabled, leading and trailing spaces are ignored when comparing lines — 'hello ' and 'hello' match. The option that is checked determines how duplicates are detected; the kept lines are always the original text.

Does it only work on exact duplicates?

Yes. The tool compares lines, not words or substrings. A line counts as a duplicate only when it is identical to a previous (or later, with 'keep last') line after the case/whitespace rules you choose. Partial overlaps are left untouched.

How big of a text can I process?

As much as your browser comfortably handles — typical documents of tens of thousands of lines are instant. The repeated-lines list is capped at 50 entries to keep the page fast, but the full deduplicated result is always complete.