Text tools

Remove Duplicate Lines

Remove Duplicate Lines

Delete repeated lines from a list and keep the first copy of each, in the original order.

About this tool

About Remove Duplicate Lines

Mailing lists, keyword lists, log extracts and merged spreadsheets collect repeats fast. Paste the list here and every line that already appeared earlier is removed, while the first copy stays exactly where it was, so the order you built is preserved, unlike a sort-then-dedupe in a spreadsheet. Lines are trimmed before they are compared, so "apple" and "apple " with a trailing space count as the same entry, and you can tick Ignore case to treat Apple and apple as duplicates too. Blank lines are left to the Empty lines setting, which can keep them, allow at most one in a row or remove them all. The summary under the panes tells you exactly how many duplicates were dropped, and the line count before and after confirms it. Other clean-up options sit alongside if the list needs more work: collapse double spaces, strip HTML or remove invisible characters that make two identical-looking lines different. The list never leaves your browser.

Built and maintained by Abhi JainUpdated

How to Remove Duplicate Lines

  1. 1

    Paste the list

    Paste one item per line into the Text box, or open a .txt or .csv file.

  2. 2

    Check the options

    Remove duplicate lines is on. Tick Ignore case if Apple and apple should match, and set Empty lines to Remove all if needed.

  3. 3

    Copy the unique lines

    Read how many duplicates were removed, then Copy or Download the cleaned list.

Remove Duplicate Lines: questions and answers

Which copy of a duplicate is kept?

The first one. Later copies are removed and everything else stays in its original position.

Why weren't two identical-looking lines treated as duplicates?

They differ in a way you can't see, often a non-breaking space or a zero-width character. Keep Remove invisible characters and Normalise odd spaces ticked, or inspect the lines with the Whitespace Visualizer.

Can I remove duplicates and sort at the same time?

Use Sort Lines with Remove duplicates ticked. This page keeps your original order instead.

How do I remove duplicate rows from a CSV?

If whole rows repeat exactly, this works on CSV text too. To de-duplicate by one column, use the CSV Cleaner.