Remove Duplicate Lines

Paste a list and every repeated line is removed as you type, with your original order kept. Nothing is uploaded.

Why remove duplicate lines?

Merged exports, copied spreadsheet columns, keyword lists and concatenated logs all collect repeats, and spotting them by eye in a list of thousands is impossible. This tool strips them in one pass while keeping your original order, so a ranking, a log or a sequence stays meaningful instead of being alphabetized. It also tells you exactly which lines repeated and how often, and can keep the last copy instead of the first, drop every repeated line, or list only the repeats.

How to remove duplicate lines

  1. Paste your list (one item per line) or open a .txt or .csv file.
  2. The result appears instantly on the right, or below on a phone.
  3. Choose which copy to keep and whether case or extra spaces should count as a difference.
  4. Copy or download the cleaned list; open Repeated lines to see what was removed.

The four ways to deal with duplicates

Take this six-line list: apple, banana, apple, cherry, banana, Apple (one per line). Here is what each mode returns, with case-sensitive matching:

ModeResultUse it for
Keep the first copyapple, banana, cherry, AppleOne copy of every line, where it first appears. The usual choice.
Keep the last copyapple, cherry, banana, AppleOne copy of every line, where it last appears: the newest entry of a log or export wins.
Remove all repeated linescherry, AppleOnly lines that occur exactly once. Anything that repeats is dropped completely.
Show only the duplicatesapple, bananaOne copy of each line that occurs more than once: find what repeats.

Tick Ignore case and "Apple" joins the "apple" group: the first mode then returns apple, banana, cherry, and "Remove all repeated lines" leaves only cherry.

When are two lines "the same"?

  • Exact text by default. "Apple" and "apple" are different lines until you tick Ignore case. Case folding handles other alphabets too: "STRASSE" matches "straße".
  • Spaces at the ends are trimmed (on by default), so a stray trailing space copied from a spreadsheet doesn't hide a duplicate. Ignore extra spaces inside lines also treats "New  York" and "New York" as the same.
  • Accents typed differently still match. An "é" typed as one character and one pasted as "e" plus a combining accent are compared after Unicode normalization (NFC).
  • Blank lines are never treated as duplicates, so paragraph spacing survives. Tick Remove blank lines to drop them all.
  • The kept line is shown as you wrote it. With case ignored, the copy that survives keeps its own capitalization.

Removing duplicates in Excel, Google Sheets and the command line

If your data already lives somewhere else, these built-in options do the same job:

  • Excel: select the column, then Data > Remove Duplicates. It keeps the first occurrence and ignores case. The =UNIQUE(A2:A100) function (Microsoft 365) returns the distinct values without touching the original.
  • Google Sheets: Data > Data cleanup > Remove duplicates, or =UNIQUE(A2:A).
  • Linux, macOS or WSL: awk '!seen[$0]++' list.txt keeps the first copy in the original order; sort -u list.txt removes duplicates but also sorts.
  • Notepad++: Edit > Line Operations > Remove Duplicate Lines.

This page is quicker for a one-off paste, works on a phone, shows you what repeated, and never uploads the list.

Common jobs and tips

  • Email lists: tick Ignore case, since addresses are not case-sensitive in practice (Ann@Example.com reaches ann@example.com).
  • Keyword or tag lists: ignore case and extra spaces, then tick Sort the result A–Z, or send the list to the text sorter for natural, numeric or length order.
  • Logs and event exports: use Keep the last copy so the newest status of each item wins.
  • Finding what changed: to compare two versions of a list rather than clean one, use the text diff checker.
  • CSV files: the whole row is compared, so two rows only match if every column is identical. To work with columns, convert with CSV to JSON.

Need counts afterwards? The word counter reports words, characters and lines; the case converter can make a list consistently lowercase before you dedupe it.

Frequently asked questions

How do I remove duplicate lines from a list?

Paste the list into the box, one item per line, or open a .txt or .csv file. Duplicates are removed as you type and the cleaned list appears next to it (below it on a phone), in the original order. Press Copy or Download .txt to take it with you.

Which copy of a duplicate is kept?

By default the first copy, at its original position. Choose "Keep the last copy" to keep the final occurrence instead, which suits logs where the newest entry should win. "Remove all repeated lines" drops every line that appears more than once, and "Show only the duplicates" lists one copy of each repeated line.

How do I remove duplicates but keep the original order?

That is what this tool does unless you tick "Sort the result A–Z". Spreadsheet commands and the command-line sort -u often reorder or sort the list; here each kept line stays exactly where it was.

How can I see which lines were duplicated?

Open "Repeated lines" under the result. It lists every line that appears more than once and how many times, most repeated first, and Copy this report copies the full list as count and line pairs. To get only the repeated lines as a clean list, choose "Show only the duplicates".

Can I ignore case or extra spaces when comparing lines?

Yes. Tick "Ignore case" so Apple and apple match, and "Ignore extra spaces inside lines" so "New York" and "New York" match. Spaces at the start and end of each line are trimmed by default; untick that to keep indentation exactly as typed.

Are blank lines treated as duplicates?

No. Blank lines (including lines of only spaces) are never matched against each other, so paragraph spacing survives. Tick "Remove blank lines" to strip them all. The two report modes and sorting leave blank lines out.

How do I remove duplicates in Excel or Google Sheets?

In Excel, select the column and use Data > Remove Duplicates, or =UNIQUE(A2:A100) in Microsoft 365. In Google Sheets, use Data > Data cleanup > Remove duplicates, or =UNIQUE(A2:A). For a one-off list, pasting the column here is quicker and also shows what repeated.

Will it remove duplicate words within a line?

No. It compares whole lines, so a repeated word inside one line is left alone, and two CSV rows only match when every column is identical. Put each item on its own line first if you want to dedupe words.

How many lines can it handle?

Lists of hundreds of thousands of lines process in about a second on a typical laptop, because each line is checked once against a hash set. Files up to 50 MB can be opened; everything runs in your browser's memory.

Is it good for cleaning up email lists?

Yes, it is one of the most common uses. Paste one address per line and tick Ignore case, since addresses are treated as case-insensitive in practice. Then sort the result or copy it straight back into your mailing tool.

Is my list uploaded anywhere?

No. Everything runs in your browser, including opened files, and nothing is sent to a server. Only your option choices are remembered in this browser, not the list itself.

Advertisement