Skip to content
cliplimeClipLime

Remove duplicate lines

Paste a list and get every line once, with counts of what was removed.

0 characters, 0 lines

Lines in
0
Lines out
0
Duplicates removed
0
Different lines
0
empty lines not counted

Options

Keeps one copy of every line.

On: Apple and apple are different lines. Off: they count as the same line.

Removes spaces, tabs and other blank characters, such as non breaking spaces, at the start and end of every line, so ' apple ' matches 'apple'. The result is trimmed too.

Where the lines that remain appear in the result.

Keep all leaves empty lines as they are. Keep one treats them like any other repeated line.

Your text stays in your browser. Nothing you type or paste is sent anywhere.

At a glance

What it does
Keeps one copy of every line and removes the repeats. A summary shows lines in, lines out and duplicates removed.
Matching
Whole lines, exact by default. You can ignore capital letters and the spaces around a line. Lines are compared after Unicode normalization, so é typed two ways matches.
Which copy
Keep the first or the last copy of a repeated line. The lines that remain stay in their original order.
Other views
Show only the lines that repeat, or only the lines that appear exactly once.
Empty lines
Keep them all, keep one, or remove them all.
Most repeated
A list shows which lines repeat most, with how many times.
Privacy
Runs in your browser. Your list is never uploaded.

How to do it

  1. 1

    Paste your list

    Put one item on each line, or load a plain text file.

  2. 2

    Choose how lines match

    Case sensitive and Trim spaces decide whether Apple, apple and ' apple ' count as the same line.

  3. 3

    Choose what you want to see

    Remove duplicates, show only repeated lines, or show only lines that appear once. For removing, pick the first or the last copy.

  4. 4

    Copy or download

    The result updates as you type. Copy it, or download it as a text file.

Exact match, ignore case, ignore spaces

By default two lines match only when they are identical, character for character. 'Apple', 'apple' and 'apple ' with a trailing space are three different lines. Two switches loosen that:

  • Case sensitive off makes Apple and apple the same line. The copy that stays is shown as it was typed.
  • Trim spaces on ignores spaces, tabs and other blank characters, such as non breaking spaces, at the start and end of each line, and removes them from the result too. Trailing spaces are the most common invisible reason for duplicates that will not go away.

For email addresses, tags and keyword lists, turn case sensitivity off and trimming on. For code, file names and anything where capitals carry meaning, leave them as they are. Matching is on whole lines only, so 'apple pie' and 'apple' are different, and misspellings are not detected. Lines are compared after Unicode normalization, so an accented letter typed as one character matches the same letter typed as a base letter plus a combining accent.

Keeping the first or the last copy

When a line appears several times, one copy stays and the rest go. Take the list a, b, a, c, b. Keeping the first copy gives a, b, c. Keeping the last copy gives a, c, b, because the last a comes before the last c and the last b.

The first copy is the usual choice, since it keeps items in the order you met them. Keep the last when later entries replace earlier ones: a log of settings changes, or a list that grows downward where the newest line is the one that counts.

Finding duplicates instead of removing them

Two other views are for finding rather than removing. Show only repeated lines lists each line that appears more than once, one copy each. Show only lines that appear once lists the lines that never repeat. The Most repeated lines panel adds the counts.

That makes a quick way to compare two lists. Paste list A and then list B into the box. If neither list has repeats inside itself, Show only repeated lines gives the items that are in both lists, and Show only lines that appear once gives the items that are in only one of them. If either list has internal repeats, remove them first.

Command line equivalents, and limits

On a command line, sort file.txt | uniq removes repeated lines, but uniq only notices repeats that sit next to each other, so the list must be sorted first, and the order is lost. sort -u file.txt does both in one go. To keep the original order and the first copy of each line, awk '!seen[$0]++' file.txt is the usual answer.

This page runs in your browser. Lists of tens of thousands of lines are fine, and bigger ones work but typing in a very large text box can feel slow. For huge files, a command line tool is a better fit. When you also want the result in order, follow up with sort lines.

Questions people ask

How do I remove duplicate lines from a list?

Paste the list into the box, one item per line. The result appears next to it with every repeated line removed, and the summary says how many were taken out.

Does it keep my lines in the same order?

Yes. The lines that remain stay in their original order. Only the extra copies are removed. To put them in order afterwards, use sort lines.

Is Apple the same as apple?

Not by default. Case sensitive is on, so they are different lines. Turn it off and they count as the same, and the copy that stays is shown as typed.

Can it show which items are in both of two lists?

Yes. Paste both lists one after the other and choose Show only repeated lines. This works when neither list has repeats within itself, so remove those first.

How are empty lines treated?

You choose. Keep all leaves them exactly as they are, Keep one treats them like any other repeated line and leaves a single one, and Remove all deletes them. In the two finding views, empty lines are skipped.

Is my list uploaded?

No. Everything runs in your browser. Nothing you paste or load is sent anywhere.

Guides that help

All Text guides →