KKwikfig.

Remove Duplicate Lines

Remove duplicate lines from any list while keeping first occurrences in order, with optional sorting, trimming and case-insensitive matching built in. Runs entirely in your browser — your numbers never leave this device.

Lines
Lines in
7
Lines out
4
Duplicates removed
3
Result

How it works

Kept lines = the first occurrence of each distinct line, in original order | Removed = total lines − kept lines | Repeated blank lines collapse to at most one blank line

Paste a list — one item per line — and the tool keeps the first occurrence of each line and drops every later repeat, preserving the original order. The result panel reports all three numbers (total lines in, lines kept, lines removed) so you can sanity-check the clean-up before using it: if you pasted 500 email addresses and 37 were removed, the kept list should hold 463 lines. An optional sort then arranges the kept lines alphabetically.

Three options control what counts as “the same line”. Trim compares lines after stripping leading and trailing spaces, which catches the classic “ apple” versus “apple ” pair left behind by spreadsheet exports. Case-insensitive matching treats Apple, apple and APPLE as duplicates and keeps the first form it met. Blank lines are handled deliberately rather than accidentally: however many blank lines your paste contains, at most one survives, at the position of the first one — a list rarely wants its gaps multiplied, and a stanza break is preserved without being duplicated.

This is batch list work that a search-engine widget cannot do at all, and it runs entirely in your browser. Lists of names, addresses, SKUs or keywords are never uploaded or stored — close the tab and the data is gone.

Worked examples

Five lines in, three unique lines out

Input
b a b c a (5 lines)
Working
The second b repeats line 1 and the second a repeats line 2, so both are dropped. First occurrences stay in their original order.
Result
Output: b, a, c — 5 total, 3 kept, 2 removed

Dedupe and sort together

Input
b a b c a (5 lines), Sort = on
Working
Deduplication first reduces the list to b, a, c as above; sorting then arranges the three kept lines alphabetically.
Result
Output: a, b, c — 3 kept, 2 removed

Case-insensitive and trimmed matching

Input
Apple apple APPLE (3 lines), Case-insensitive = on — and separately: “ apple ” / apple / banana with Trim = on
Working
With case-insensitive matching, all three Apple lines share one key, so only the first survives. With trimming, “ apple ” and “apple” compare equal after spaces are stripped, while banana is distinct.
Result
Apple list: 1 kept, 2 removed · Trim list output: apple, banana — 3 total, 2 kept, 1 removed

Frequently asked questions

Does it keep the first or the last occurrence?

The first. The output preserves the order in which distinct lines first appeared, which matters when the list order means something — a running order, a priority list, steps in a process. If order does not matter, turn on Sort for an alphabetical result.

Why did a line with trailing spaces survive as “different”?

By default lines are compared exactly, character for character, so “apple ” (with a trailing space) is not the same line as “apple”. Turn on the Trim option to compare lines after surrounding spaces are stripped — that catches most spreadsheet and copy-paste near-duplicates.

What happens to blank lines?

They collapse to at most one. If your text contains several blank lines — between sections, or from stray Enter presses — the first blank line is kept in place and the rest are removed. A completely blank input produces no output lines at all.

Can it remove duplicate words instead of lines?

Not directly — this tool works line by line. Put each word on its own line first (a text editor's replace-all can turn the spaces between words into line breaks), dedupe, then join the lines back. For counting how often words repeat rather than removing them, use the Word Frequency Counter.

Is there a size limit?

The comparison is a single pass with a lookup set, so lists of tens of thousands of lines are handled comfortably in the browser. Extremely large pastes (millions of lines) will be limited by your device's memory rather than by the tool.

Is my list uploaded anywhere?

No. Deduplication runs in your browser; your list is never sent to a server, stored or tracked.

Related tools

More in Text Tools · Browse all tools