Remove Duplicate Lines

Paste a messy list and get back a clean one: every repeated line removed, the first occurrence kept, and the original order untouched. See exactly how many duplicates were dropped.

Runs in your browser — your code and data never leave this device

How do I remove duplicate lines from a list?

Paste your list here: this free online tool removes duplicate lines and keeps only the first copy of each one, in the original order — the list is never sorted, reordered or renumbered. Options ignore case, trim spaces and remove empty lines too, and the counts show how many duplicates were dropped.

Lines in: 0
Lines out: 0
Duplicates removed: 0

Related tools

How to use the Remove Duplicate Lines

  1. Paste your lines into the Input box — one item per line — or click Sample to load an example list.
  2. Tick Ignore case if Apple and apple should count as the same line, and leave Trim spaces on to treat lines that differ only by trailing spaces as duplicates.
  3. Click Remove Duplicates. The first copy of each line is kept, later copies are dropped, and the original order is preserved.
  4. Check the counts, then Copy output or Download the clean list as a text file.

For the full picture — why duplicates appear, what counts as a duplicate, and how to clean a list properly — read our guide: How to Remove Duplicate Lines (Free, Keeps the Order).

Why duplicates creep into lists

Duplicate lines appear whenever lists are built by copying from more than one place: merging two spreadsheets, combining email lists, collecting URLs from several exports, or pasting search results together. Each source is clean on its own, but the merged list repeats entries, and the repeats are scattered so far apart that scanning by eye misses them.

The cost is real even when it looks trivial. A mailing list with duplicates sends the same email twice to the same person. A list of product codes with repeats inflates counts and breaks lookups. A keyword list with duplicates wastes time in analysis. Removing duplicates is a small job, but it is the kind of small job that quietly prevents larger mistakes.

How the first occurrence is kept

This tool reads your lines from top to bottom and keeps the first time each line appears. Later copies are dropped, and everything else stays exactly where it was — the tool never sorts, reorders or renumbers your list. That matters when the order carries meaning, such as a ranking, a timeline or the sequence in which items were collected.

Two options control what counts as a duplicate. Ignore case treats Apple and apple as the same line, which is what you want for email addresses and names. Trim spaces removes leading and trailing whitespace before comparing, so a line copied with a stray space still matches its clean twin. Both options only affect the comparison — the kept line is shown as it was, except for trimming when that option is on.

Cleaning lists before you use them

Removing duplicates is usually one step in a longer clean-up. Sort the list first if you want the output in alphabetical order — a sorted list also makes remaining near-duplicates easier to spot, like the same name spelled two ways. Check for empty lines, which this tool can drop for you with the Remove empty lines option, and watch for invisible characters like non-breaking spaces that can make two identical-looking lines compare as different.

For very large lists, work in chunks and check the counts each time: the Lines in, Lines out and Duplicates removed figures tell you exactly what changed, so a surprising number is easy to catch before the cleaned list goes anywhere. And keep the original until you have checked the result — this tool never stores your list, so once you close the page the input is gone.

First copy kept, order untouched: how dedupe works here

Remove duplicate lines keep order is the whole point of this tool: the first occurrence of each line stays exactly where it was, later copies are dropped, and the original order is untouched. That matters for lists where order means something — a ranked list, a mailing list in the order people signed up, or a log file where the sequence is the story.

Three options tune the match: Ignore case treats Apple and apple as the same line, Trim spaces strips leading and trailing spaces before comparing, and Remove empty lines too drops blank lines along with the duplicates. The counts show input lines, unique lines and duplicates dropped, and the cleaned list copies to the clipboard or downloads as a .txt file.

Frequently asked questions

Does the tool sort my list?

No. It keeps the first occurrence of each line and preserves the original order of everything else. If you want the result sorted as well, use the Sort Lines tool afterwards.

Are Apple and apple treated as duplicates?

Only when Ignore case is ticked. By default the comparison is exact, so different capitalisation counts as a different line. Tick the box when case does not matter, for example with email addresses.

What happens to empty lines?

Empty lines are kept by default, except for a trailing blank line at the end of your paste. Tick Remove empty lines too if you want every blank line dropped.

Is there a size limit?

No fixed limit, but very large pastes of hundreds of thousands of lines may feel slow in the browser. For lists that big, split them into chunks of a few tens of thousands of lines.

Is my list uploaded anywhere?

No. This tool runs entirely in your browser using JavaScript. Your text is never uploaded, stored or sent anywhere — everything stays on this device.

Can I remove duplicates from an email list?

Yes — paste the list of addresses, one per line, and the tool keeps the first copy of each address in order. Turn on Ignore case if some addresses differ only in capitalisation, and Trim spaces if the list was pasted from a spreadsheet.

Which copy is kept — the first or the last?

The first. The first occurrence of each line stays exactly where it was, and later copies are dropped — so the cleaned list keeps the order of first appearance, which is usually the order that matters.

What does the Trim spaces option do?

It strips leading and trailing spaces from each line before comparing, so a line with a stray space counts as a duplicate of the same line without one. It is useful for lists pasted from spreadsheets, where extra spaces creep in.