What This Tool Does

This tool removes all duplicate lines from a block of text, leaving only unique lines. Options let you preserve the original order, sort alphabetically, ignore case, and trim whitespace before comparing. Useful for cleaning email lists, log files, CSV data, and any repeated content.

Inputs Explained

How It Works

Each line is optionally trimmed and lowercased to produce a comparison key. The tool keeps a Set of seen keys and outputs only lines whose key has not been seen before. When 'Preserve Order' is off, the unique lines are sorted using JavaScript's default locale-aware string comparison.

Formula / Logic Used

seen = new Set() unique = lines.filter(l => { k = normalize(l); if(seen.has(k)) return false; seen.add(k); return true; })

Remove Duplicate Lines

Remove duplicate lines from any text block in one click. 100% client-side.

Step-by-Step Example

Input:

apple
banana
Apple
orange
banana
grape

Options: Preserve order ✓, Case insensitive ✓

Output:

apple
banana
orange
grape

Removed: 2 duplicates (Apple matched apple; second banana matched first).

Use Cases

Assumptions and Limitations

Disclaimer: All processing happens in your browser. No text is uploaded or logged anywhere.

Frequently Asked Questions

How does the tool decide what counts as a duplicate?

By default, two lines are duplicates only if they match exactly. With 'Trim whitespace' enabled, leading/trailing spaces are ignored. With 'Case insensitive' enabled, 'Apple' and 'apple' are treated as the same line.

Does it preserve the order of my lines?

Yes, if 'Preserve original order' is checked. The first occurrence of each unique line is kept in its original position. If unchecked, the unique lines are sorted alphabetically.

Can I deduplicate email addresses safely?

Yes. Enable 'Case insensitive' and 'Trim whitespace' — emails are case-insensitive by spec (RFC 5321), so user@example.com and User@Example.com are the same inbox.

What's the maximum input size?

The tool handles several million characters comfortably on a modern browser. Performance depends on your device — very large inputs may take a second or two.

Is my data sent to a server?

No. All deduplication runs entirely in your browser using native JavaScript. Once the page loads, you can use it offline.

Does it remove blank lines?

Optional. Enable 'Remove empty lines' to drop all blank lines from the output. Otherwise, blank lines are treated like any other line — only one blank line survives deduplication.

Can I remove duplicates from a CSV file?

Yes, if you treat each CSV row as one line. Paste rows in, dedupe, and copy back. For column-level deduplication, use a spreadsheet's Remove Duplicates feature instead.

Why do I still see similar-looking duplicates?

They likely differ by invisible characters — trailing spaces, tabs, or different Unicode representations (é as one char vs e + combining accent). Enable 'Trim whitespace' or normalize your input first.

Sources and References

Related Calculators

Sort LinesFind & ReplaceWhitespace RemoverEmail ExtractorCase ConverterWord Counter