Free text tool

Remove duplicate lines from a list without changing its order

Paste email addresses, IDs, keywords or any one-item-per-line list to remove duplicate lines online. The cleaning runs in your browser as you type, and the first occurrence of each line stays exactly where it was.

First occurrences keep their orderCase-sensitive switch, off by defaultBlank lines removed unless you say no
Remove Duplicate Lines

Paste a list on the left. Repeated lines are dropped as you type and the cleaned list appears on the right with the first occurrence kept.

Runs on your device
Unique lines
The cleaned list appears here.
0
Lines removedduplicates and blank lines
0
Lines pasted
0
Unique lines

What the Remove Duplicate Lines does

Remove Duplicate Lines reads your text line by line from top to bottom. The first time a line appears it is kept; every later repeat is dropped. The cleaned list appears in the box on the right, and the counts underneath tell you how many duplicate or blank lines were removed. Two buttons let you copy the result to the clipboard or download it as a plain-text file named unique-lines.txt.

Two checkboxes control the matching. Case sensitive is off by default, so Apple, APPLE and apple count as one line and the first spelling you pasted is the one that survives. Turn it on when capitalisation distinguishes real values, such as product codes or case-sensitive usernames. Remove blank lines is on by default and discards lines that are empty or contain only spaces and tabs.

The tool does not sort, trim or reformat anything. Lines come out in the order they went in, minus the repeats, which keeps a list recognisable and makes it safe for data where position matters. It suits mailing lists, keyword research exports, log output, inventory codes and any column pasted out of a spreadsheet.

How to use it

Paste the list

Put one item per line in the top box. Windows and Unix line endings are both recognised, so text copied from any editor or spreadsheet works.

Set the two options

Tick Case sensitive if ID-100a and ID-100A are different items for you. Untick Remove blank lines if a blank separator should stay in the output.

Copy or download the result

The cleaned list is already in the right-hand box. Use Copy to put it on the clipboard or Download TXT to save unique-lines.txt.

How two lines are judged to be duplicates

A line is compared as a whole, from its first character to its last, against every line kept so far. Nothing is trimmed, so a line with a leading space, a trailing space or a trailing comma is a different line from the same text without it. If your source has inconsistent spacing, tidy it in a spreadsheet or editor first, or the duplicates will survive.

With Case sensitive off, each line is lowercased before the comparison, using the browser's locale-aware lowercasing. The lowercased form is used only for matching; the line written to the output is the original, with its capitalisation intact. Lowercasing is not the same as full Unicode case folding, so a few pairs that a dedicated case-folding routine would merge stay apart here, for example the German sharp s against a double S.

What happens to blank lines

With Remove blank lines on, any line that is empty or holds only whitespace is discarded before duplicate checking, and it is counted in the removed total. Most list clean-ups want this, because blank lines in an export are rarely data.

With the option off, a blank line is treated like any other line. The first empty line is kept and every later empty line is a duplicate of it, so it is removed. That means the output can hold at most one truly empty line. A line containing two spaces is a different line from an empty one, so whitespace-only lines of differing lengths each survive once.

Order, counts and the output file

The kept line is always the first occurrence, in its original position. There is no option to keep the last occurrence, and no sorting. The removed count shown under the result is simply the original line count minus the result line count, so it combines duplicates and discarded blank lines in one figure.

The downloaded file is plain UTF-8 text with Unix line endings and no header. Copy uses the browser clipboard, which requires a secure page and may ask for permission the first time; if copying does nothing, select the text in the result box and copy it by hand.

  • Case sensitive off: Apple, APPLE and apple collapse to the first one pasted
  • Case sensitive on: each spelling is kept as a separate line
  • Remove blank lines on: empty and whitespace-only lines are dropped
  • Remove blank lines off: one empty line survives, later ones are duplicates

Cleaning an email list: what to check first

Email addresses are a common use, and the default case-insensitive mode is the right setting for them, since Sam@Example.com and sam@example.com almost always reach the same mailbox. Two things will still defeat the matcher: addresses with stray spaces around them, and addresses prefixed with a display name or mailto:. Strip those in your spreadsheet before pasting, or the duplicates will remain.

Limits to know before you rely on it

  • Matching is exact apart from optional lowercasing. Leading or trailing spaces, tabs or a trailing comma make two otherwise identical lines different.
  • Case-insensitive mode uses simple lowercasing, not full Unicode case folding, so a few scripts, such as the German sharp s or the Turkish dotted I, may not merge as expected.
  • Repeated blank separators cannot be preserved: with blank removal off, only the first empty line survives because later ones count as duplicates.
  • The tool does not sort, trim or normalise lines. Do that before pasting if you need it.
  • The whole list is held in the page's memory, so several hundred thousand lines can make typing sluggish on a low-memory device.
  • There is no file picker; text must be pasted. Output can be downloaded as TXT.

Questions people ask about the Remove Duplicate Lines

Will the cleaned list be sorted?

No. Lines keep the order they had in your input, and only later repeats are taken out. If you want a sorted result, sort the list in a spreadsheet or editor before or after cleaning.

Which copy of a duplicate is kept?

The first one, in its original position. When Case sensitive is off, the first spelling encountered is the one written to the output, so a list that starts with APPLE and later has apple will keep APPLE.

Does case-insensitive mode change the text of my lines?

No. Lowercasing is used only to decide whether two lines match. The line that reaches the output is written exactly as it first appeared, with its original capitalisation.

Why were two lines that look the same not treated as duplicates?

Almost always because of whitespace: one has a trailing space, a tab or a non-breaking space the other lacks. Lines are compared without trimming. Remove the extra spaces in your source and paste again.

How is the removed count calculated?

It is the number of lines you pasted minus the number of lines in the result. With Remove blank lines on, that figure includes the blank lines that were discarded as well as the duplicates.

Can I upload a file instead of pasting?

Not at the moment. Open the file in any text editor, select all, copy and paste it into the box. The cleaned result can then be saved with Download TXT, which produces a file named unique-lines.txt.

Sources and further reading