Remove Duplicate Lines
Strip duplicates from a list of lines. Optionally ignore case and surrounding whitespace when comparing, keep only lines that appeared more than once, or invert to keep only the unique ones.
🔒 100% Client-Side & Private — processed locally in your browser. Files never leave your device.
Options
Your result will appear here
Type or paste your input above, adjust the options, then press Run. Tip: press Ctrl+Enter to run, and ? for every shortcut.
How it works
What removing duplicates produces
The tool works line by line: it groups lines by a comparison key, decides which copy of each group to keep, and writes the survivors back in their original order. The output is plain text with the same newline structure as the input, and the stats report how many lines were kept and how many were removed. Nothing is sorted or reordered, so a list that arrived in a meaningful sequence stays in that sequence after the duplicates are gone.
The four ways to choose a survivor
Keep-first is the default: the earliest copy of each line survives and later duplicates disappear. Keep-last does the reverse, keeping the final occurrence and dropping the earlier ones, which matters when a later line corrects an earlier one in a log or a config dump. The two filter modes go further: only-lines-that-repeat keeps the lines that appeared more than once and drops the singletons, while only-lines-that-appear-once keeps the singletons and drops the repeats. Each surviving line in a filter mode is emitted once, at its first position.
How comparison keys are formed
The ignore-case and ignore-spaces options change the key used for comparison, never the text that is written out. With ignore-case on, Apple and apple are treated as the same line and whichever the chosen mode keeps is emitted exactly as it was typed. With the trim option on, surrounding whitespace is stripped before comparison, so an indented duplicate still counts as a repeat while the kept line keeps its indentation. Blank lines are the exception: with the never-remove-blank-lines option on they always survive, whatever the mode.
Where it fits and where it runs
This is a line-level tool, so it will not merge lines that differ only in a trailing comma or a timestamp — clean those up first if they should count as equal. Because order is preserved, pair it with the sort tool when you want a sorted unique list rather than an as-found one. Everything is a pure text pass in your browser: the list you paste is deduplicated locally and never uploaded, and no request is made while it runs.
Questions
Does it re-sort the output?
No. Original order is preserved. Use Sort Lines first if you also want it sorted.
What do the two filter modes do?
Only lines that repeat keeps just the lines whose comparison key occurs more than once, and Only lines that appear once does the opposite. In both cases each surviving line is emitted once, at the position of its first appearance, so a run of three identical lines contributes a single output line.
How are blank lines treated?
With the never-remove-blank-lines option on, blank lines always pass through untouched in every mode. With it off, a blank line is compared like any other, so a run of empty lines collapses to one in the keep-first mode and only the final one survives in keep-last.
Related tools
See categorySort Lines
Sort lines alphabetically, numerically, by length, naturally, or shuffle them.
Whitespace Visualizer
Reveal spaces, tabs, line endings, non-breaking spaces and zero-width formatting characters.
Word Frequency Counter
Count how often each word appears, with case folding, a minimum length, stop-word removal and a top-N limit.
Add Line Numbers
Prefix every line with a running number, with configurable start, separator, zero-padding.