Remove Duplicate Lines
The free online tool to remove repeated lines from your text.
Deduplicate lists, log lines, email and keyword lists, live as you type, keeping the order, then copy or download.
Deduplicated Text
What does Remove Duplicate Lines do?
Remove Duplicate Lines is a free tool that strips the repeated lines out of multi-line text. Type or paste your lines into the box above, one item per line, and the deduplicated version appears instantly in the result panel, with no button to press and no signup. Then copy the result to your clipboard or download it as a plain text file. It runs entirely in your browser, so your text never leaves your device.
The tool works at the line level: it compares whole lines and keeps only one copy of each, leaving the order of the lines that remain exactly as it was. By default it keeps the first occurrence of each line and is case- and whitespace-sensitive, so nothing is merged that you did not intend. Four options let you change that. Ignore case treats lines that differ only in capitalisation as duplicates. Ignore leading and trailing spaces compares lines after trimming the spaces at each end, while the line that is kept keeps its original spacing. Remove blank lines also drops empty and whitespace-only lines. And the Keep selector switches between keeping the first or the last copy of each duplicate.
Removing duplicate lines is the cleanup you want whenever a list has grown messy. It is ideal for deduplicating lists such as email addresses, usernames or keywords, for tidying CSV or log lines before you import or analyse them, and for merging two lists into one without leaving repeats behind. Because you see the result live, you can toggle the options until the output looks right, then copy it in one click.
This tool sits alongside the rest of the text suite, and it is worth being clear about the difference. To clean up messy spacing rather than remove lines, use remove extra spaces. To count how many lines you have, use the line counter. To count distinct words rather than deduplicate whole lines, use the unique word counter. And to put the lines in order after deduplicating, use sort text lines. Everything runs in your browser with no account and nothing to install. Paste your lines above to deduplicate them instantly, then copy or download the result.
Remove Duplicate Lines Examples
| Behaviour | Input | Output | Removed |
|---|---|---|---|
| Remove a repeated line | apple banana apple cherry | apple banana cherry | 1 |
| Ignore case | Apple apple APPLE | Apple | 2 |
| Ignore surrounding spaces | apple apple | apple | 1 |
| Remove blank lines | a b a | a b | 3 |
| Keep the last copy | a b a | b a | 1 |
*Every row is produced by the same engine this page uses. The repeated lines in the input column are real; the output and removed count are what the tool returns.
Features of Our Remove Duplicate Lines Tool
Repeated Lines
Line Order
& Spacing
Blank Lines
You Type
Download
& Private
Frequently Asked Questions
Click any question to read the answer.
How do I remove duplicate lines from text?
Paste or type your text into the box above, one item per line, and the deduplicated version appears instantly in the result panel below. By default it removes every repeated line and keeps the first copy, leaving the order of the remaining lines unchanged. For example the lines "a", "b", "a" become "a", "b". Then use Copy to put the result on your clipboard, or Download to save it as a plain text file.
Does it keep the order of my lines?
Yes. The lines that survive stay in their original order, so the tool is safe for lists where order matters. It does not sort or shuffle anything; it only drops the repeats. If you also want the lines sorted, dedupe here first, then sort the result.
Can I keep the first or the last copy of a duplicate?
Yes. Use the "Keep" selector to choose. "First" keeps the earliest occurrence of each line and removes the later copies, which is the default. "Last" keeps the latest occurrence instead, so the surviving line sits at its final position. Either way the kept lines stay in document order.
Is the comparison case-sensitive?
By default yes, so "Apple" and "apple" are treated as different lines and both are kept. Turn on "Ignore case" to treat lines that differ only in capitalisation as duplicates, keeping just one of them. The kept line keeps its original capitalisation.
What about extra spaces around a line?
By default a line with leading or trailing spaces is different from one without, so both are kept. Turn on "Ignore leading/trailing spaces" to compare lines after trimming the spaces at each end. Only the comparison is trimmed; the line that is kept keeps its original spacing.
Can it remove blank lines too?
Yes. Turn on "Remove blank lines" and the tool also drops empty and whitespace-only lines, not just duplicates. With it off, blank lines are treated like any other line, so repeated blank lines are deduplicated but a single blank line is kept.
How is this different from Remove Extra Spaces?
Remove Extra Spaces cleans up the whitespace inside and around your text, such as double spaces and trailing spaces, without removing any lines. This tool works at the line level: it compares whole lines and removes the repeated ones. Use Remove Extra Spaces to tidy spacing, and this tool to deduplicate a list.
How is this different from the Unique Word Counter?
The Unique Word Counter counts how many distinct WORDS appear in your text. This tool removes duplicate LINES and gives you back the cleaned text. One works on words for counting, the other on whole lines for deduplicating, so they answer different questions.
Is my text stored when I use this tool?
No. The tool runs entirely as JavaScript inside your browser, so your text is never uploaded, logged, or sent to a server. The page keeps working offline once it has loaded, and nothing you type leaves your device. You can deduplicate a private list with no privacy risk at all.