Text Formatting

Remove Duplicate Lines

Deduplicate lists, keywords, or logs while keeping first or last occurrences cleanly.

0
Original Lines
0
Unique Lines Kept
0
Duplicates Removed

Understanding Your Results

Each output panel above updates locally in real time as your text changes. Here is what every metric or transformation produced by Remove Duplicate Lines represents:

  • Original Lines, Unique Lines Kept & Duplicates Removed: Reports exact counts before and after filtering so you can audit how many redundant entries disappeared.
  • Unique Output Pane: Preserves either original insertion order or optionally sorts remaining rows naturally from A to Z.

What is Remove Duplicate Lines?

Remove Duplicate Lines is a fast list deduplication utility that scans line-by-line input and preserves only a single unique entry for repeated strings.

Whether consolidating subscriber email lists, cleaning scraped sitemap URLs, merging keyword research sheets, or trimming redundant log messages, manual spreadsheet filtering breaks easily when stray trailing spaces disguise duplicates.

How Does It Work?

Lines split across CRLF/LF breaks pass through an O(1)-lookup JavaScript `Map` structure. By default, leading/trailing spaces are trimmed before comparison so `"apple"` and `"apple "` register as the exact same row rather than sneaking through as phantom uniques.

Scanning forwards keeps the first occurrence (`keepLast` off), whereas toggling "Keep last occurrence" scans backwards from bottom to top while preserving final-state ordering—vital when later log rows supersede earlier ones.

How to Use Remove Duplicate Lines Step by Step

  1. Paste your raw multi-line list into Input Lines.
  2. Configure checkboxes: Trim whitespace, Ignore empty lines, Case-sensitive, Sort output, and Keep last occurrence.
  3. Inspect Original Lines, Unique Lines Kept, and Duplicates Removed metrics alongside Unique Output.
  4. Copy or download the clean unique TXT file.

Calculation Methodology & Rules

Uses linear hash-map keying with optional Unicode locale-lowercased normalization and `Intl.Collator` natural numeric sorting when "Sort output" is active.

Note that Duplicates Removed tracks `originalLines - uniqueLines`, which includes stripped blank lines when Ignore empty lines is active.

Unique = Map.dedup(lines, key = caseSensitive ? trimmed : trimmed.toLocaleLowerCase())

Practical Use Cases

  • Cleaning CRM contact sheets, newsletter subscriber exports, and domain blocklists.
  • Consolidating keyword research clusters across multiple SEO spreadsheets.
  • Trimming repeated error messages out of server stack traces or console dumps.

Practical Usage Examples

Catching Hidden Whitespace & Casing Duplicates

Input: Berlin berlin Tokyo TOKYO

Output / Insight: With Case-sensitive unchecked and Trim whitespace checked, outputs 2 lines ("Berlin", "Tokyo") and removes 2 duplicates.

Keeping Most Recent Revision Order

Input: ItemA ItemB ItemA (updated vs plain duplicate)

Output / Insight: Checking "Keep last occurrence" retains the final matching appearance when ordering matters.

Benefits & Limitations

Key Benefits

  • Maintains exact original list sequence unless you explicitly opt into sorting.
  • Catches subtle duplicates caused by accidental trailing spaces or mixed capitalization.
  • Processes tens of thousands of list rows offline with zero email/URL privacy exposure.

Important Limitations

  • Comparisons match whole lines—lines differing by even a single comma, trailing period, or middle typo count as separate entries.
  • Comma-separated items packed onto a single horizontal line should be split onto separate lines (via Find and Replace Text `,` -> newline) prior to deduplication.
  • Uncheck Trim whitespace if leading indentation matters inside structured code files.

Frequently Asked Questions

Why did two identical-looking lines remain when I unchecked Trim whitespace?

One of the lines almost certainly ended with an invisible space or tab. Keep Trim whitespace checked to normalize line edges cleanly.

Can I deduplicate case-sensitively for programming variables or hashes?

Yes. Check Case-sensitive so "API_Key" and "api_key" remain distinct entries.

What does Keep last occurrence change?

Instead of keeping the earliest position where a duplicate appeared, the final position in the list is retained—useful when newer entries replace older copies.

Does Sort output sort numbers properly (e.g. 2 before 10)?

Yes. Our optional Sort output check uses `Intl.Collator` numeric comparison so multi-digit numbers order naturally.