TextJanitor

Remove Duplicate Lines

Paste a list and remove repeated lines in one step, or switch modes to see which lines repeat and how often.

What to show
Keep which copy
Lines in
0
Lines out
0
Duplicates removed
0

Working…

Your text is processed in your browser and is never uploaded or stored on our servers.

How to use the Remove Duplicate Lines

  1. 1 Paste your list into the box, one item per line.
  2. 2 Choose what to show: the list without duplicates, only the duplicates, or only lines that appear once.
  3. 3 Set the options: case sensitivity, trimming, empty lines, which copy to keep and whether to sort.
  4. 4 Copy the result or download it as a .txt file.

What the tool does

This tool reads your text one line at a time and compares the lines with each other. By default it keeps the first copy of every line and drops the rest, so the order of your list stays as it was. The counters show how many lines went in, how many came out and how many duplicates were removed.

Before

apple Banana apple Banana cherry banana

After

apple Banana cherry banana

How lines are compared

Two lines count as the same when their comparison text is identical. With the defaults, spaces at the start and end of a line are ignored, so " Banana" matches "Banana", but capitals matter, so "banana" is kept as a different line. Turn off Case sensitive to treat them as the same, or turn off Trim spaces to compare lines exactly as typed. Whichever copy is kept appears in your result unchanged, with its original spacing and capitals.

Three ways to look at your list

  • Remove duplicates keeps one copy of each line. Choose whether it is the first or the last occurrence.
  • Show only duplicates lists each repeated line once, followed by how many times it appeared, such as apple (3×).
  • Keep only lines that appear once drops every line that has a twin, which is useful for finding what two merged lists do not share.

First or last, and sorting

Keeping the first occurrence preserves the order in which items first appeared. Keeping the last occurrence keeps each line where it appeared for the final time, which helps when later entries are newer and should win. You can also sort the result from A to Z or Z to A. For more sorting choices, such as numeric or by length, use the line sorter.

Tips and common mistakes

If lines that look identical are not being removed, they probably differ in a way you cannot see, such as a trailing tab, a non-breaking space or a zero-width character. Run the text through the line break and invisible character cleaner first. Remember that empty lines are lines too: leave Remove empty lines off if the gaps matter to you.

Frequently asked questions

Does it keep my original order?

Yes, unless you choose to sort the result. The lines that remain stay in the order they appeared in your list.

Why are lines that look the same not removed?

They usually differ in capitals, trailing spaces or invisible characters. Turn off Case sensitive, keep Trim spaces on, and clean hidden characters with the line break remover if needed.

How do I find which lines are repeated?

Choose "Show only duplicates, with counts". Each repeated line is listed once with the number of times it appears.

What does keeping the last occurrence do?

Each line stays at the position of its final appearance, and earlier copies are removed. Use it when later entries are newer than earlier ones.

Is there a limit on the size of my list?

No fixed limit. It is built to handle lists of around a million characters in your browser, and you may see a short "Working…" message with very large pastes.

Is my list uploaded anywhere?

No. The comparison happens in your browser and your lines never leave your device.