Remove Duplicate Lines
Paste a list or block of text and the tool drops repeated lines while keeping the original order. Trim whitespace, sort alphabetically, or mark duplicates for review instead of removing them.
How to use the duplicate line remover
1. Paste the text
Drop your list or text block into the Input box, or use Open .txt file to load a plain-text file from your device. By default the tool treats every newline as a record boundary. Each line is compared as a complete unit, edge to edge, against every other line. If your list uses another separator, pick it under Separators: comma, semicolon, tab, pipe, any custom text, or a regular expression. Join output with sets how the surviving items are put back together (the same separator by default, or a new line, comma, comma + space, semicolon, tab or custom text).
2. Set the toggles
Four toggles cover the common edge cases. Case-sensitive defaults off, so "Apple" and "apple" collide. Trim whitespace before comparing defaults on, so accidental leading or trailing spaces do not block matches. Sort output alphabetically defaults off (original order preserved); turn it on for a canonical A-to-Z output. Remove empty items defaults off; turn it on to drop blank and whitespace-only lines before deduping.
3. Pick the keep mode
Four modes control what happens to duplicates. Keep first (default) drops every copy after the first time a line appears. Keep last drops every earlier copy and only the final occurrence survives. Keep all, mark duplicates does not remove anything; it appends a marker to every line that has at least one duplicate so you can audit before cutting. Delete all repeated lines removes every copy of any line that appears more than once, so only the lines that occur exactly once are left.
4. Clean and copy
Click Clean. The deduped text appears on the right with a count of removed lines and a breakdown of which lines were repeated. Use the Copy button to grab the result, or Download to save a .txt file.
When you need to remove duplicate lines
Line-level duplication is one of the most common cleanup problems in everyday text work. Here is where it shows up.
Line dedup vs word dedup
This tool dedupes at the line level. The whole line, every character up to the newline, is the unit. Two lines must match end-to-end to be considered duplicates. If you only need to drop repeated words inside a paragraph, use the word-level tool instead.
| Tool | Unit | Best for |
|---|---|---|
| Remove Duplicate Lines | Whole line (newline-delimited) | Lists, address books, CSV rows, URL exports, log entries. |
| Remove Duplicate Words | Single token (space-delimited) | Prose stutters ("the the"), vocab extraction, tag cleanup. |
A common mistake is to use line dedup on a paragraph of prose and find that nothing changes (because no two full lines match). If that happens, switch to word-level dedup.
Deduplication patterns: input to output examples
The dedup result depends on how the comparison is made. Seven common scenarios people run into, and what survives with the settings this tool has:
| Scenario | Input (one per line) | Output |
|---|---|---|
| Email list, mixed case | Alice@example.com, alice@example.com, ALICE@EXAMPLE.COM | Case-sensitive off (default): Alice@example.com (one row, the first form is kept). |
| URL list, trailing-slash variants | word.tips/, word.tips, word.tips/ | 2 rows survive: word.tips/ and word.tips. The tool does not strip trailing slashes, so normalize them first if both mean the same page. |
| Keyword list with stray spaces | word counter, word counter (trailing space), word counter | Trim whitespace off: 3 rows. Trim whitespace on (default): 1 row. |
| Keep first vs keep last occurrence | apple (line 1), banana (line 2), apple (line 5) | Keep first: apple, banana. Keep last: banana, apple. |
| Case-sensitive vs case-insensitive comparison | Apple, apple, APPLE | Case-sensitive: 3 rows. Case-insensitive: 1 row (the first form is kept). |
| Spaces inside a line | hello world (double space), hello world (single space) | 2 rows. Trim only strips spaces at the start and end of a line, so collapse inner spaces first if they should match. |
| JSON-lines, comparing as strings | {"id":1,"name":"a"}, {"name":"a","id":1} | Both survive (string-equal comparison sees different key orders as different lines). |
Rule of thumb: decide what counts as the same line before you dedupe. By default the tool ignores case and trims spaces at the start and end of each line, so alice@example.com and Alice@Example.com count as one line. Turn on Case-sensitive or turn off Trim whitespace when those differences matter. Everything else, such as trailing slashes or doubled spaces inside a line, is compared exactly as typed, so normalize it first.
Related tools
Frequently asked questions
How do I remove duplicate lines from a list?
Paste the list (one item per line) into the input box. Leave Trim whitespace on so accidental indentation does not block matches. Keep the default Keep first behavior. Click Clean. The unique lines come out in their original order, with a count of how many duplicates were dropped.
What does Trim whitespace before comparing actually do?
When this toggle is on (the default), the tool strips leading and trailing whitespace from each line before comparing. So "apple", " apple", and "apple " are all treated as the same line. The surviving copy is trimmed in the output. Turn this off only if whitespace at the edges is meaningful to your data (rare).
How is this different from removing duplicate words?
This tool dedupes at the line level: an entire line (every character up to the newline) is the unit. Two lines must match end-to-end to be considered duplicates. The Remove Duplicate Words tool dedupes at the word level (single tokens). Pick line-level for lists, address books, CSV-style rows. Pick word-level for prose stutters or vocab extraction.
What happens with empty lines?
By default, empty lines are counted as a line. If you have three blank lines in a row, two of them are duplicates and will be dropped. Turn on the Remove empty items toggle to drop every blank or whitespace-only line before deduping. If you need to keep blank lines as paragraph separators, dedupe first and then re-format.
Can I remove duplicates from a comma-separated list?
Yes. Under Separators, set Split input on to Comma (or Semicolon, Tab, Pipe, Custom text or Regular expression). Each item between separators is then treated like a line. Join output with is Same as input by default; pick Comma + space or New line to change the output format. With Trim whitespace on, the space after each comma is ignored when comparing. To split on commas and new lines at the same time, choose Regular expression and enter [,\n].
How do I keep only the lines that appear once?
Pick the Delete all repeated lines keep mode. Every line that occurs two or more times is removed completely, including its first copy, and only the lines that occur exactly once stay in the output. The breakdown lists each repeated line and how many copies were removed.
Will sorting change the order of unique lines?
Yes. With Sort output alphabetically OFF (the default), the original order is preserved (the first occurrence of each unique line stays where it was). With it ON, the output is re-ordered A to Z after dedup. Use sort when you want a canonical list (for example, before importing into a spreadsheet column).
What does Keep all but mark duplicates do?
This mode does not remove anything. Instead, each line that has at least one duplicate gets a marker appended (for example "[DUPLICATE]") so you can review the matches manually before deciding what to remove. Useful when the dedup is irreversible and you want to audit first.
Does case sensitivity matter for line dedup?
With case-sensitive OFF (the default), "Apple" and "apple" on different lines are treated as duplicates. With it ON, they are different lines. Most prose and casual list cleanup wants OFF. Code identifier lists, URLs with case-sensitive paths, or filename lists usually want ON.
I'm pasting email lists and customer records to remove duplicate rows. Are those contacts going to your database?
No. Row dedup runs in your browser. Email addresses, customer records, and any other rows you paste stay in the textarea and are not transmitted to any database on our end. See also: Text to One Line and all removers.
More wordcounter.ai tools
Other tools you might find useful.