Duplicate Line Remover
Remove duplicate lines from any text, with control over case sensitivity and which occurrence to keep.
Options
Keep occurrence
Last updated:
Remove duplicate lines from text
This duplicate line remover takes a block of text, one item per line, and returns only the unique lines. It is useful for lists of emails, keywords, URLs, log lines or any other line-based data.
How to use it
- Paste your text into Input Text, with one entry per line.
- Set the options you need (see below).
- Choose to keep the First occurrence or the Last occurrence of each repeated line.
- Click Remove Duplicates, then Copy the Unique Lines.
How it works
The tool splits your text at line breaks and builds a comparison key for each line. Lines with a key that was already seen are dropped. The remaining lines stay in their original order. When you keep the last occurrence, the tool scans from the end and then restores the order.
What you see
| Option | Effect |
|---|---|
| Case-sensitive | On by default. Turn it off to treat "Apple" and "apple" as the same line. |
| Trim whitespace before comparing | Ignores spaces at the start and end of a line when matching. Off by default. |
| Remove blank lines | Deletes empty or whitespace-only lines. Off by default. |
Three counts appear under the result: original lines, unique lines and duplicates removed.
Assumptions and limits
- Only whole lines are compared. It does not find repeated words inside a line.
- The text is not sorted. Output keeps the order of the lines you kept.
- The line that is kept is output exactly as typed, even when trimming or case-folding was used for matching.
- Blank lines removed with "Remove blank lines" are not counted as duplicates.
Frequently asked questions
Why are some similar lines not removed?
Lines that differ by a trailing space or by capital letters count as different by default. Turn on "Trim whitespace before comparing" or turn off "Case-sensitive" to match them.
What is the difference between keeping the first and last occurrence?
With first, each repeated line stays at the position where it first appeared. With last, it stays at the position of its final appearance.
Does it keep one blank line or remove all of them?
Without "Remove blank lines", repeated empty lines are treated as duplicates, so one stays. With it on, all blank lines are removed.
Related Text Tools
Browse all tools from the same category.
Word Counter
Words, characters, sentences, and paragraphs
Open toolText Case Converter
Upper, lower, title, and sentence case
Open toolShowing 1-2 of 27