How to remove duplicate lines
- Paste your text into the Text with duplicate lines box, one item per line.
- Choose your options: Case-insensitive, Keep first or last occurrence, Trim whitespace before comparing, Remove blank lines and Sort A, Z.
- Click Apply to deduplicate the list. The result appears below, ready to use.
- Hit Copy to grab the clean, unique list for your spreadsheet, email or code.
What each option does
- Case-insensitive, treats lines that differ only in capitalisation as the same, so Apple and apple collapse into a single entry. The line that survives still shows its own original capitalisation.
- Keep the first / last occurrence, controls which copy of a duplicate survives. Keep first drops every later repeat and leaves the surviving lines in their original order. Keep last drops every earlier repeat instead, so a repeated line moves down to where it last appeared.
- Trim whitespace before comparing, treats “foo” and “foo ” (with a trailing space) as the same line for matching purposes. The surviving line keeps its own original spacing, this option changes what counts as a duplicate, it never edits your text.
- Remove blank lines, strips empty or whitespace-only rows so they don't clutter the output. This is a separate step from trimming for comparison above.
- Sort result A, Z, orders the unique lines alphabetically (natural order, so item2 comes before item10). Leave it off to keep the original order.
Choose which occurrence survives
By default the tool keeps the first time a line appears and quietly drops every later copy, so the order of your remaining unique lines is exactly the order they first showed up in your text. Switch to keep last and it drops everyearlier copy instead, keeping only the final occurrence, useful when a later row in your data is the corrected or most up to date version of an earlier one. Either mode works well for cleaning email lists, keyword lists, CSV columns, log files or any list where duplicates need to go. The live counters show how many lines went in, how many unique lines came out, how manyduplicates were removed, and (when that option is on) how many blank lines were stripped, so you can see the cleanup at a glance.
Frequently asked questions
Does it keep the first or last duplicate?
Either, it's your choice. Pick “Keep the first occurrence” and every later repeat is dropped, or pick “Keep the last occurrence” and every earlier repeat is dropped instead.
Does trimming change the text of the line that's kept?
No. Trimming before comparing only affects which lines count as duplicates. The line that survives keeps its own original spacing. Tick “Remove blank lines” separately if you want whitespace-only lines gone entirely.
Can I deduplicate a very long list?
Yes. Paste as many lines as you like, the only limit is your browser's available memory.
Which copy of a duplicate is kept?
You choose. Keep the first occurrence and every later repeat is dropped, so the original order of unique lines is preserved. Keep the last occurrence and every earlier repeat is dropped instead, so the surviving line sits at the position of its final appearance. Either way, sorting A, Z is optional and off by default.
What does case-insensitive do?
When ticked, lines that differ only in capitalisation, such as “Apple” and “apple”, are treated as the same line. The line that's kept still shows its own original capitalisation, only the comparison ignores case.
Does trimming before comparing change my output?
No. “Trim whitespace before comparing” only affects how lines are matched, so “foo” and “foo ” with a trailing space are treated as duplicates. The line that survives keeps its own original spacing, it is not trimmed. Use “Remove blank lines” separately if you want whitespace-only lines stripped out.
Related: sort text lines · clean up messy text · count words & characters