HCODX/Deduplicate Lines
100% browser-based · Preserves order · Case + trim toggles

Deduplicate Lines

Remove duplicate lines from text. Keeps the first occurrence of each line, with optional case-insensitive matching and whitespace trimming.

Plain text
Unique lines
Dedupe options
Sort Lines
Input lines
0
Output lines
0
Removed
0
Status
Ready
Example

Duplicates in, unique lines out

Keeps only the first occurrence of each line. Stable — original order is preserved.

Input
apple
banana
apple
cherry
banana
apple
fig
Deduplicated
apple
banana
cherry
fig
Use cases

What you'll use this for

Lists, logs, exports — anywhere duplicates sneak in and you need a clean unique set.

Log unique entries

Strip repeating error messages from a noisy log to see distinct events.

Email list cleanup

Remove repeated addresses pasted from multiple sources before a campaign.

CSV deduplication

Dedupe a column dumped from a database export. Pair with trim before compare.

Unique words

Combine with one-word-per-line input to produce a unique vocabulary list.

Step by step

How to deduplicate lines

1

Paste your text

Drop the list, log, or column into the left editor. One entry per line.

2

Pick options

Toggle case-insensitive and trim if your duplicates differ only in case or surrounding spaces.

3

Click Dedupe

Or leave auto-dedupe on for live updates. Runs locally — no upload.

4

Copy or download

Copy to clipboard or save as unique.txt. Or jump to sort-lines to alphabetize.

FAQ

Frequently asked questions

Yes. The first occurrence of each line stays in place; later duplicates are dropped. If you need an alphabetized output instead, pipe the result through the sort-lines tool.

Yes. Apple and apple count as different lines. Flip the Case-insensitive toggle to fold case before comparing.

Yes. No signup, no limits, no ads. Runs entirely in your browser.

The algorithm is O(n) using a hash set, so it scales linearly with input size. Multi-megabyte inputs finish in a fraction of a second on a modern laptop.

Not in one step — this tool preserves order. Run the result through sort-lines for a sorted unique list (the classic sort | uniq combination).

About

About deduplicating lines

Deduplication is the operation of reducing a multiset of lines to a set: each distinct value appears exactly once. The order-preserving variant — implemented here — keeps the first occurrence of each line and drops everything after, which is the behaviour of awk '!seen[$0]++' on the command line.

How it works

  • Each line is hashed into a set as it's read.
  • If the hash is already present, the line is skipped; otherwise it's appended to the output.
  • Optional pre-processing (trim, lowercase) is applied to the hash key only — the original line is preserved in the output.

When to use which option

  • Case-insensitive — emails, usernames, hostnames, anything where case shouldn't matter.
  • Trim before compare — copy-pasted lists with stray indentation or trailing spaces.
  • Auto-dedupe — leave on for live previews while you tweak the source text.
Related

Related tools