Duplicate Line Remover

Paste a list and get back only the unique lines, in their original order, with full control over how matches are compared.

Keep:

Processed in your browser. Your list is never uploaded or stored.

0
Input lines
0
Unique lines kept
0
Duplicates removed
0
Empty lines removed

Most Repeated Lines

Lines that appear more than once will be listed here with their counts.

Advertisement

How to Use the Duplicate Line Remover

Paste your list into the left box, one item per line. The right box fills with the unique lines immediately, and it keeps updating as you edit the input or change an option. The four counters show how many lines went in, how many came out, how many duplicates were dropped, and how many blank lines were removed, so you can sanity-check the result at a glance. When you are happy with the output, copy it to the clipboard, download it as a plain text file, or push it back into the input box with "Use Output as Input" if you want to keep refining it.

Below the tool, the Most Repeated Lines panel lists the entries that occurred more than once and how many times each appeared. That is often the more interesting result: it tells you which email address was entered five times, which SKU was double-scanned, or which keyword your team brainstormed independently. Everything happens in your browser, so the list never leaves your computer.

How Duplicate Detection Works

The tool reads your text one line at a time, separating lines on any style of line break: Unix (LF), Windows (CRLF), or old Mac (CR). For each line it builds a comparison key according to your options. With trimming on, leading and trailing spaces and tabs are removed. With case sensitivity off, the key is lowercased. The key is also normalized to Unicode NFC form, so an "é" typed as a single character and an "é" built from "e" plus a combining accent are recognized as the same text, which matters when lists are merged from different operating systems or apps.

Each key is checked against a hash set of keys already seen. If the key is new, the line is kept and the key is recorded; if it has been seen, the line is counted as a duplicate and dropped. Because a hash-set lookup takes roughly constant time, the whole job is a single pass through the list, so even a list with hundreds of thousands of lines is processed quickly. That is the same approach used by the classic command-line idiom awk '!seen[$0]++', and it is why the original order of your list survives intact. Tools that sort first and then remove adjacent repeats are also correct, but they scramble your order in the process.

Choosing the Right Options

Case-sensitive is on by default because it is the safest assumption: "Apple" and "apple" are different strings, and for things like product codes, passwords, or file names on Linux, case genuinely matters. Turn it off for natural-language lists, names, tags, and email addresses, where capitalization is usually accidental. When case is ignored, the kept line retains the capitalization of the occurrence that survives.

Trim whitespace removes spaces and tabs from both ends of each line before comparing, and the output uses the trimmed text. Leave it on unless the indentation itself is meaningful, such as in code or outlines. Trailing spaces are the single most common reason two lines that look identical are not treated as duplicates.

Advertisement

Remove empty lines deletes every blank or whitespace-only line. When it is off, blank lines are left exactly where they were and are never counted as duplicates, so paragraph spacing or section breaks in your list are preserved instead of collapsing into a single gap.

Keep first vs. keep last decides which copy survives. Keeping the first occurrence is the usual choice and matches spreadsheet behavior. Keeping the last occurrence is useful when later entries supersede earlier ones: a log of status updates where you want each item's most recent position, a settings file where the final value wins, or a list built by appending corrections to the end. The unique lines still appear in the order of their surviving copies.

Practical Uses

Mailing lists are the classic case. Exports from sign-up forms, event registrations, and CRMs routinely contain the same address several times, and sending duplicates annoys recipients and wastes sending quota. Turn case sensitivity off and trimming on, paste the addresses, and you have a clean list in seconds.

The same pattern applies to keyword research, where lists from several sources overlap heavily; to inventory or asset tags gathered by multiple people; to URL lists for redirects, sitemaps, or crawls; to blocklists and allowlists for firewalls, ad blockers, or spam filters; and to bibliography or citation lists merged from several drafts. Developers use it to tidy .gitignore files, dependency lists, and log excerpts before pasting them into a bug report. Writers use it to strip repeated lines from transcripts or to clean up lists of names for a credits page.

Pitfalls to Watch For

Exact matching is literal. "Acme Inc." and "Acme Inc" differ by a period, "St." and "Street" are different strings, and "Jon Smith" is not "John Smith". This tool deliberately does not guess at near-duplicates, because fuzzy matching on a list of customer records can merge two different people. If you suspect near-duplicates, sort the list first so similar entries land next to each other, then review them by eye.

Invisible characters are the next trap. Text copied from web pages, PDFs, and chat apps can contain non-breaking spaces or zero-width characters in the middle of a line, which trimming cannot remove because they are not at the ends. If two lines refuse to merge, retype one of them or run the text through a plain-text editor.

Finally, each line is compared as a whole. If you paste rows from a spreadsheet with several columns, two rows are duplicates only if every column matches. To deduplicate on one column, such as email address, paste just that column, or use your spreadsheet's built-in tool and choose the column there.

Other Ways to Remove Duplicates

Spreadsheets have this built in. Excel's Data → Remove Duplicates works on selected columns and keeps the first occurrence. Google Sheets offers Data → Data cleanup → Remove duplicates, and the UNIQUE() formula returns a live, deduplicated copy of a range. These are the right choice when your data is already tabular and you need to match on specific columns.

On the command line, sort -u removes duplicates but also sorts the output, and uniq on its own only removes repeats that sit next to each other, which surprises many people. To keep the original order, awk '!seen[$0]++' file.txt is the standard one-liner. A browser tool is the fastest option for a one-off list, especially on a machine where you cannot install software, and it is a good way to preview what a script will do before running it on the real file. If you need the cleaned list in alphabetical, numeric, or random order afterward, the Text Sorter picks up where this tool leaves off.

Frequently Asked Questions

Does removing duplicates change the order of my lines?

No. Unique lines stay in their original order. With "keep first" each line appears where it first occurred; with "keep last" it appears where it last occurred. If you also want the list alphabetized, run the result through a text sorter afterward.

Why are two lines that look identical not treated as duplicates?

They differ in a way you cannot see: a trailing space, a tab instead of spaces, a non-breaking space, or a zero-width character. Turning on "Trim whitespace" handles spaces and tabs at the ends of lines. Characters hidden in the middle of a line need to be cleaned up in the source.

Should I compare email addresses case-sensitively?

Usually not. Domain names are case-insensitive, and while the part before the @ is technically allowed to be case-sensitive, virtually every mail provider treats it as case-insensitive. Turning case sensitivity off catches duplicates like Jane@Example.com and jane@example.com.

How many lines can this tool handle?

Hundreds of thousands of lines work comfortably on a typical computer, because each line is checked against a hash set in a single pass. The practical limit is your browser's memory. Very large pastes are processed with a short delay so typing stays responsive.

Is my list uploaded anywhere?

No. Deduplication runs entirely in your browser with JavaScript. Your list is never sent to a server, which makes the tool safe for customer emails, internal IDs, and other data you should not paste into online services that process text remotely.

Advertisement

Related Articles

Expert guides and educational resources to help you master the math.

Related Tools

More free text utilities to help with your writing.