A remove duplicate lines cheat sheet is a decision guide for choosing an exact or normalized comparison rule, removing repeated lines while keeping the first occurrence, and checking the result before replacing the source.
The Remove Duplicate Lines tool fits line-oriented lists such as copied spreadsheet columns, tags, keywords, filenames, SKU exports, and log values. It keeps the first line for each comparison key, reports input, output, and removed counts, and runs the split, comparison, counting, and output generation locally in the browser.

Pick the comparison rule that matches your data
Every line receives a comparison key. The first line with a given key is retained, and later lines with that key are removed. When normalization is enabled, the comparison key and the retained text are not identical.
| Setting | Comparison key | Appropriate use | Important limitation |
|---|---|---|---|
| Strict | The complete line, unchanged | Lists where case or whitespace may carry meaning | Capitalization, punctuation, Unicode characters, and all spacing participate |
| Ignore English letter case | The full line converted with English-locale lowercase | Ordinary English lists with inconsistent capitalization | The first occurrence keeps its original capitalization |
| Ignore edge whitespace | The line trimmed at both ends | Lists with accidental leading or trailing spaces or tabs | The retained output is not trimmed |
| Both options | Edge trimming first, then English-locale lowercase | Lists with case and outer-whitespace differences | Neither option rewrites the retained first line |
Strict comparison is safest when capitalization or whitespace may carry meaning. Under this rule, “Apple” and “apple” are different, and a line containing one trailing space differs from the same visible letters without that space.
Ignore English letter case creates the comparison key with the browser’s English-locale lowercase operation. It does not rewrite the retained line, so the first occurrence keeps its original capitalization. This option does not perform accent folding, transliteration, Unicode normalization, fuzzy matching, stemming, or language-aware collation; for example, a German sharp s is not automatically treated as the two letters “ss”.
Ignore edge whitespace trims only the comparison key at both ends. The retained output is not trimmed. If the first occurrence is surrounded by spaces and a later line contains the same visible value without them, the spaced first occurrence is preserved and the later line is removed. Internal spaces and tabs still participate in the comparison.
Run the removal workflow
The supported workflow has four clear stages:
- Paste one value per line. Use a plain list or a single column copied from a spreadsheet, log, or export. Each line boundary becomes a separate value to compare.
- Choose the equality rule. Leave both ignore options off for strict matching, enable either one for the corresponding normalization, or enable both when case and edge-whitespace differences should be ignored together.
- Remove duplicates. The tool creates a comparison key for each line, records keys already encountered, and retains only the first unseen line.
- Verify the counts and copy the result. Review the reported input, output, and removed counts, inspect the exact retained first occurrences, and then copy them.
Processing happens locally in the browser, and no text is uploaded or stored by Lizely. Editing the pasted text or either comparison option clears the previous result, preventing stale output from being mistaken for the current result.
See how the first occurrence wins
Consider five input lines in this order: “alpha”, “Beta”, “alpha”, “ beta” with one leading space, and “Beta”.
Under strict comparison, the retained lines are “alpha”, “Beta”, and “ beta”. The second “alpha” is removed because it is an exact repeat. The space-prefixed “beta” remains because its leading space makes the complete line different. The final “Beta” is removed because an exact “Beta” appeared earlier.
With both ignore options enabled, the retained lines are “alpha” and “Beta”. Trimming and lowercasing are applied only to the comparison keys, so the first “Beta” remains capitalized exactly as it appeared. The retained lines themselves are not rewritten.
Check boundary and blank-line cases
Line-ending rules matter when the pasted text comes from different operating systems or applications.
| Situation | Defined behavior |
|---|---|
| Windows CRLF, standalone CR, and LF | All are recognized as line boundaries, and a CRLF pair counts as one boundary |
| Generated output | Retained lines are joined with LF, so output boundaries are normalized |
| Trailing line boundary | Creates a final empty line before deduplication |
| Blank lines | They are valid values; the first matching blank key remains and later matching blanks are removed |
| Edge trimming with blank-like lines | A whitespace-only line and an empty line share an empty comparison key, so whichever appears first remains |
| Source order | Retained values stay in their original order because the list is never sorted |
| Second-pass behavior | The output is not searched again, and similar values are not merged |
Under strict comparison, an empty line and a whitespace-only line are different because every character participates. A trailing boundary can therefore affect both the blank-line content and the reported counts. If the desired output must contain no blank values, use Remove Empty Lines as a separate cleanup step afterward.
Verify the result before replacing the source
The count display is a checkpoint, not proof that every retained line is the business record you want.
- Compare the reported input, output, and removed counts with the list you pasted.
- Inspect the exact retained lines, especially their capitalization, edge whitespace, blank lines, and order.
- Confirm that the first occurrence is the one worth keeping; the tool does not choose the newest, longest, most frequent, or otherwise preferred duplicate.
- Compare the copied result with the original before replacing or deleting source data.
- Rerun the operation after editing the text or changing either option, because either action clears the previous result.
For business records, deduplication by a visible line may be weaker than deduplication by a stable database identifier. Confirm the comparison rule before deleting anything and keep the original available until the output has been checked. The browser utility prepares text; it does not mutate the original file or database.
Know the input and format limits
The accepted input limit is exactly 1,000,000 UTF-16 code units. One code unit beyond that limit is rejected before the text is split or comparison keys are allocated. Empty input is also rejected rather than reported as a misleading one-line result.
- Use plain, line-oriented text. The tool does not parse CSV quoting, JSON arrays, code syntax, or locale-specific records.
- Do not expect word-frequency counts, inferred headers, similar-value merging, or a second deduplication pass.
- Remember that the output is newly generated plain text with LF boundaries, even when the input used CRLF or CR.
- Do not treat visible lines as guaranteed unique business identifiers when records can differ only in fields the workflow cannot parse.
The result is deterministic for the same input and selected options. Its only retention rule is the first occurrence of each comparison key.
Understand the processing model behind the cheat sheet
The implementation splits CRLF before standalone CR or LF, derives one comparison key per line, records seen keys in a JavaScript Set, appends the first unseen line, and joins retained values with LF. The Set tracks previously encountered keys; it neither sorts the output nor chooses a preferred duplicate.
When edge trimming is enabled, the comparison key uses JavaScript’s String trim operation. If case ignoring is also enabled, lowercasing follows trimming. Because trimming affects only the key, the retained first line can still contain its original visible edge whitespace.
This workflow suits copied spreadsheet columns, email campaign tags, keyword lists, allowlists, filenames, SKU exports, and log values. When visual differences may carry business meaning, review the strict, case-insensitive, edge-trimmed, and combined rules before accepting the cleaned list.
For a deeper look, see Remove Duplicate Words and Repeated Keywords.