Remove repeated lines from any block of text
Remove repeated lines from any text block, with options for case sensitivity and whitespace handling.
Interactive Sample Data
| id | line |
|---|---|
| 1 | nairobi |
| 2 | mombasa |
| 3 | nairobi |
How this tool works
Things that usually go wrong
- Lines with invisible Unicode whitespace (non-breaking space) look identical but won't match standard spaces — use 'trim whitespace' mode to normalise them.
- Tab-separated lines where only the tab width differs visually will still be treated as different lines — tabs are significant characters.
- If you paste CSV and want row-level deduplication, use the 'Remove Duplicate Rows' tool instead — this tool treats each CSV row as a flat string.
Edge cases we tested
Multiple consecutive blank lines are collapsed to one blank line (blank is a valid line value).
Kept as distinct by default; treated as duplicates only when 'trim whitespace' is specified.
The fifth (final) occurrence is kept; the first four are dropped.
Compared in lowercase; first occurrence ('Apple') is kept, the other two dropped.
Returned unchanged — no lines removed.
Frequently Asked Questions
Does this preserve the original line order?
Yes — lines appear in the order they were first seen. Add 'sorted A–Z' to your instruction if you want alphabetical order instead.
Can I remove duplicates from a CSV column rather than free text?
This tool works on lines. For CSV column deduplication, use 'Remove Duplicate Rows' and specify the key column.
What counts as a 'line'?
Any sequence of characters terminated by a newline (\n, \r\n, or \r). Blank lines and whitespace-only lines are valid lines.
Will it handle very large inputs?
Yes — the engine runs inside your browser tab and handles several megabytes of text without issue.
Related tools
Sort Lines Alphabetically
Sort any block of text lines alphabetically, reverse alphabetically, or numerically.
Open Tool →Remove Empty Lines
Remove all blank and whitespace-only lines from any block of text.
Open Tool →Remove Extra Spaces
Collapse multiple consecutive spaces into one and strip leading/trailing spaces from any text.
Open Tool →Remove Duplicate Rows
Eliminate duplicate rows across your entire dataset or based on specific unique key columns.
Open Tool →