Remove Duplicate Lines: Dedupe Text Online

0
Words
0
Characters
0
No spaces
0
Lines
0
Paragraphs
0
Sentences
0 min
Reading time
Lines with duplicates
Deduped output

Paste any list, strip exact duplicates, keep the order or sort the result. Case-insensitive and trim-whitespace modes included.

What this tool does

A free, in-browser utility for removing duplicate lines from a single block of text. Paste your input, pick whether to preserve the original order or sort the output, and the duplicates are gone. Nothing leaves your machine.

It is the GUI equivalent of sort -u on the command line, or awk '!seen[$0]++' when you want to keep the first occurrence in original order. If you have ever pasted a 4,000-line email export into a terminal just to run sort | uniq, this is the same thing without the terminal.

Dedup is exact and line-based. Two lines have to match character for character (unless you pick the case-insensitive or trim button) to count as duplicates. Fuzzy matching and near-duplicate detection are left out on purpose, because they need a threshold you would have to tune. To see which lines were dropped, put the original list and the cleaned one side by side in our online text compare tool.

How the dedup works

Internally the tool walks each line once and tracks seen values in a hash-backed set, the same data structure as JavaScript's Set or Python's set. Lookups are O(1) on average, so even a million lines finish in well under a second on an ordinary laptop. The underlying algorithm is plain hash-table membership.

Two orders. Dedupe (keep order) keeps the first occurrence of each line and drops every later duplicate, the way awk '!seen[$0]++' behaves. Dedupe + sort emits each unique line once in sorted order, the way LC_ALL=C sort -u behaves: plain character order, so uppercase letters come before lowercase. Pick whichever your downstream consumer expects.

Two more buttons change how lines are compared. Dedupe (Aa) treats Alice@example.com and alice@example.com as the same line. Dedupe + trim ignores leading and trailing spaces and tabs when comparing, so " example", "example ", and "example" collapse to one entry. Both keep the first occurrence as it was written. The plain Dedupe button matches exactly what was typed, which is the safe default.

How to remove duplicate lines in three steps

One pane in, one pane out. Nothing is uploaded.

  1. 1

    Paste your lines

    Drop the text into the input pane. Any list works: emails, IPs, URLs, SKUs, log timestamps, package names, anything one-per-line. Click Sample to load an example with intentional duplicates if you want to see the result first.

  2. 2

    Click a dedupe button

    Dedupe (keep order) keeps the first occurrence of each line, like awk '!seen[$0]++'. Dedupe + sort returns the unique lines sorted, like sort -u. Dedupe (Aa) lets Alice and alice collapse, and Dedupe + trim ignores leading and trailing spaces. Each is one click, so try another if the first result is not what you wanted.

  3. 3

    Copy or download the result

    The deduped list appears in the right pane, and your input stays untouched on the left so you can see what went. Copy grabs it for pasting elsewhere; Download gives you a .txt file. Both panes scroll independently so you can spot which lines went missing.

When you want this tool

Cleaning a marketing email list before import

Export your list from one CRM, splice in another from a webinar signup, paste both into the tool, and click Dedupe (Aa) so Alice@ and alice@ count as one address. Mailchimp and HubSpot reject duplicate addresses on import anyway, but they reject the whole batch instead of just the dupes, so doing this first saves a re-upload.

Deduping IP addresses in an audit log

Pull the source IPs from a week of auth.log with awk, paste them in, click Dedupe (keep order). You get a clean list of unique attackers without losing the rough chronological signal of "who showed up first". Feed that into your firewall block list.

Cleaning a list of URLs scraped from multiple pages

Scraping a sitemap and a paginated index will return the same URL multiple times. Drop the combined list in, sort and dedupe, and you have a canonical crawl frontier. Trailing slashes and query strings still count as different lines, so normalise those first if you want them merged.

Reducing pip freeze or npm ls noise to unique packages

pip freeze across two virtualenvs, or npm ls --all across a monorepo, prints the same package on many lines. Concatenate, paste, dedupe, and you have one line per name==version for a quick eyeball of what is installed.

CSV rows pasted from multiple sources

Works for line-level dedup, which is what you usually need when each row is a self-contained record. Heads up: this is plain text dedup, not column-aware. If you want true row-level dedup that respects quoted commas and ignores column order, use a real CSV tool. For most pasted-from-spreadsheet cases, line dedup is enough.

Cleaning a copied bibliography or citation list

Copying references from three browser tabs into one document leaves you with the same DOI repeated four times. Paste them in and click Dedupe + trim (copy-paste from PDFs loves to add stray spaces), and you get a clean references section. Sort mode is handy here for alphabetical reference lists.

Dedup quick reference

The edge cases that bite most often when deduplicating text. Worth scanning once before you trust the output.

TopicWhat this tool does
Order preservation Dedupe (keep order) keeps the first occurrence and drops later dupes. Like awk '!seen[$0]++' or Python list(dict.fromkeys(lines)). Dedupe + sort uses plain character order, like LC_ALL=C sort -u.
Case sensitivity Case-sensitive except on Dedupe (Aa). Alice and alice are distinct on every other button. Email and username lists usually want it on; SKU lists usually do not.
Whitespace trimming Only on Dedupe + trim. Elsewhere " example", "example ", and "example" are three different lines. Internal spaces are never touched.
Blank lines Treated as a normal line value: empty string. With dedup on, you keep one blank line if any existed in the input. Delete that last one by hand if you want none.
Line endings (CRLF vs LF) A line ending in \r\n is technically different from one ending in \n if the trailing \r survives splitting. Lines are split on CRLF, LF and a lone CR, so mixed endings collapse and never create ghost duplicates.
Unicode normalisation Two visually identical strings can compare unequal if one uses NFC and the other NFD (precomposed vs decomposed accents). This tool does no normalisation. If you suspect this, normalise both inputs to NFC first with String.prototype.normalize('NFC') or Python unicodedata.normalize.
Trailing newline at end of input A file that ends with \n has a phantom empty last line. Most editors hide this. It is treated as the end of the last line, not as a blank line, and the output ends with a newline too.
Encoding UTF-8 throughout. The browser handles decoding when you paste; if your bytes were Latin-1 or Windows-1252 originally, characters outside ASCII may be wrong before the dedup even runs. Convert encoding upstream.

Remove duplicate lines: frequently asked questions

Does this preserve the original order or sort the output?

Both, your choice. Dedupe (keep order) keeps the first occurrence of each line and drops every later duplicate, so the output reads in the same order as the input. Dedupe + sort returns the unique lines sorted. Preserve order is what you want when the order carries meaning (chronological logs, ranked lists). Sort is what you want when you just need a clean unique set.

Is the comparison case-sensitive?

By default yes, because that is the safe assumption. Alice and alice are different lines unless you click Dedupe (Aa). Most email systems treat addresses as case-insensitive on the local part, so for email lists that is almost always the button you want. Same goes for usernames on case-insensitive platforms. For SKUs and identifiers that are genuinely case-sensitive, leave it off.

Can it ignore leading and trailing whitespace?

Yes, with the Dedupe + trim button. It ignores leading and trailing spaces and tabs when comparing, so " example ", "example ", and "example" all collapse into a single entry. Useful when your input was hand-edited or copy-pasted from a PDF, both of which leave stray spaces. Internal whitespace inside a line is left alone.

Why not just pipe the list through uniq?

The uniq command only collapses adjacent duplicates, which is a common surprise. Two identical lines separated by a different line will both survive uniq. That is why the unix idiom is sort | uniq or sort -u: you have to sort first so duplicates are next to each other. This tool does not need a sorted input, because it tracks every seen line in a hash set as it goes.

Does it count how many duplicates each line had?

No, that is a different feature. If you need counts, the unix command for it is uniq -c after a sort: sort input.txt | uniq -c | sort -rn gives you a frequency table sorted by count, which is what you want when finding the most common entries. This tool focuses on cleanup, not analysis.

How big an input can I paste?

A few million lines is fine. The dedup itself is O(n) with constant-time hash lookups, so the bottleneck is the browser rendering the result pane, not the dedup. For very large inputs (50 MB+), expect a noticeable pause when the textarea repaints. If your input is that big, you almost certainly already have sort -u available; use it.

Is it free, and do I need to sign up?

Free, no account, no catch. There is no signup wall, no daily limit on how much you paste, and no paid tier hiding the useful options behind a login. Paste your list, dedupe it, copy the result, close the tab. Ads on the page cover the cost of running it.

How is this different from Excel's Remove Duplicates or the command-line sort -u?

No spreadsheet, no terminal: you paste into one box and click. Excel needs you to load the data into a column and run a dialog; sort -u needs a shell. There is also a real behaviour difference. uniq only drops adjacent duplicates, so you have to sort first, which scrambles your order. This catches duplicates anywhere in the text and can keep the original order. And nothing you paste is uploaded.

Is my text private, or is anything uploaded?

Nothing is uploaded. The dedup runs entirely in your browser against a JavaScript Set, so your list never touches a server, never gets logged, and never gets stored. You can paste an internal email export, a customer list, or a leaked-password check without it leaving your machine. To confirm, open your browser DevTools, watch the Network tab, and dedupe: no outbound request fires.

Does it work offline and on my phone?

Both. Once the page has loaded, the dedup is local JavaScript, so you can turn off Wi-Fi or go through a tunnel and it keeps working. On a phone the layout stacks the input and output so you can paste a list from an email or a notes app, dedupe it, and copy the result back. There is nothing to install and no app to download; it is just the web page.

How is this different from a text editor like Notepad++ or Sublime Text?

Plenty of editors can dedupe lines, but it is tucked away. Notepad++ needs the TextFX plugin, or a sort that only drops adjacent duplicates; Sublime hides it under Permute Lines, then Unique. Here it is the entire point of the page: paste, click, copy, with no plugin to install and nothing uploaded. The catch is that an editor keeps your file open to keep working on it, so for a quick one-off list this is faster, but for real editing you will still go back to the editor.

Privacy and how this works

Your text never leaves your browser. The dedup runs on your machine against a JavaScript Set, and what you paste is not logged. The whole tool is a few lines of code: split on newlines, walk through, keep what we have not seen. The standard library primitives behind it are documented at MDN's Set reference and the equivalent Python set docs.