Keep Unique Lines
Keep only the first occurrence of each line and report how many duplicates were removed.
What this page computes
Paste a list and the page keeps the first occurrence of every distinct line, in the order those lines first appeared. Each line is trimmed before it is compared, so a trailing space does not make a duplicate look unique, and the surviving line is printed trimmed. The second line reports how many lines came in, how many were kept and how many were removed.
Where it stops
Comparison is case-sensitive: Alpha and alpha are two different lines here, and the case-insensitive page is a separate tool. Blank lines are dropped rather than deduplicated, so the output is a list of values and not a preserved layout. One column is all it reads — a duplicate is a whole line, not a repeated field inside one.
The deduplication is a Set built in this tab. Nothing is uploaded, nothing is stored, and the same paste always prints the same lines.
`alpha`, `beta`, `alpha`, `gamma`, `beta` becomes `alpha`, `beta`, `gamma`: the first occurrence of each line survives in input order, and the second line reports five in, three kept and two removed.
Comparison is case-sensitive and each line is trimmed first, so a trailing space cannot make a duplicate look unique.
How to use it
Paste the list and press Run. The output keeps the order of first appearance rather than sorting, so the list still reads like the one you pasted.
The arithmetic
Each trimmed line is offered to a Set; the first time a value is seen it is kept and the rest are counted as removed. That makes the work one pass with a hash lookup per line rather than a pairwise comparison.
Where it stops
Comparison is exact text: no case folding, no Unicode normalisation and no whitespace tolerance inside a line. Blank lines are removed rather than deduplicated, so the output is a list of values, not a preserved layout.
What to Expect
Best for
- `alpha`, `beta`, `alpha`, `gamma`, `beta` becomes `alpha`, `beta`, `gamma`: the first occurrence of each line survives in input order, and the second line reports five in, three kept and two removed.
- Seeing the result before copying it.
What this tool keeps
- Your input is converted in the browser and never posted, so the page works offline and retains nothing.
Sample input
alpha, beta, alpha, gamma, beta
Sample output
alpha beta gamma 5 lines in → 3 lines kept, 2 lines removed (exact match; blank lines are dropped)
Frequently asked questions
How do I use it?
Paste the list and press Run. The surviving lines are printed first, then a count of what came in, what was kept and what was removed.
Is anything uploaded?
No. The text is converted in this tab with JavaScript: no request is made, no account is needed, nothing is stored, and the page keeps working offline once loaded.
What are its limits?
Case must be treated as significant, so Alpha and alpha stay separate; the case-insensitive variant is a different page. Blank lines are dropped and only whole lines are compared, so a repeated field inside one line is not a duplicate.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.