What Remove Duplicate Lines does, and when you need it
Remove Duplicate Lines takes out the lines that repeat in a text and keeps the first copy of each. The lines that are left stay in the order they had, so a list keeps its shape: nothing is sorted. The result appears in the second box as you paste, ready to copy or download, with a line that says how many repeats went. The box with your own text is never changed.
Three choices decide what counts as a repeat: whether capital letters matter, whether spaces at the ends of a line matter, and whether empty lines go too. It runs in your browser: your text is never uploaded and never saved, so closing the page forgets it.
Some jobs it is made for:
- A contact or email list pasted from several places, where the same address appears twice or more.
- A list of names for an event, a class or a team, made from more than one sign-up sheet.
- Keywords, tags or product codes copied from a spreadsheet, where repeats crept in.
- Log files and lists of links, where the same line is written again and again.
- A shopping list joined from two people's lists.
Step by step: removing repeated lines
It takes a few seconds, and the same steps work on a phone and on a computer:
- Put your text in the top box, one item on each line. Paste it with the Paste button, with Ctrl+V, or by pressing and holding in the box on a phone. You can also type it, choose Open a text file, or drop a text file anywhere on the page. Press Try a sample to see it on a short list of fruits first.
- Choose what counts as the same line. Ignore capital letters is off at first, so Apple and apple are different lines. Ignore spaces at the ends is on, so
appleandapplewith a space after it are the same. Remove empty lines too is on, so blank lines go. - Read the line under the result. It says, for example, "1 repeated line removed; the first of each is kept." or "No repeated lines."
- Copy or download the result. Copy puts the whole cleaned list on your clipboard; Download saves it as a text file.
Press Try a sample: the box fills with nine lines (Mango, banana, Apple, mango, Cherry, banana, an empty line, Guava, apple). The result keeps Mango, banana, Apple, mango, Cherry, Guava and apple: the second banana is the only repeat, and the empty line goes too. Tick Ignore capital letters and mango and apple go as well, as repeats of Mango and Apple.
What counts as a repeat, exactly
The tool reads the text line by line, from the top. The first time it meets a line, it keeps it; each later line that counts as the same is taken out. The rules are written here in full, and the same rules are checked by our tests.
| Part | The rule | Example |
|---|---|---|
| A line | Everything between two line breaks. A Windows line break counts once | Each item of a list on its own line |
| The same line | Two lines with the same characters, after the two options below are applied for the comparison | banana and banana |
| Ignore capital letters | Off at first. On, lines that differ only in capitals count as the same | On: Hello World, hello world and HELLO WORLD leave one line |
| Ignore spaces at the ends | On at first. Spaces and tabs at the start and end of a line don't count when lines are compared | apple, apple and apple are the same |
| Which copy stays | The first, exactly as it was written, with its own capitals and spaces | Apple before apple keeps Apple |
| The order | The lines that stay keep the order they had. Nothing is sorted | c, a, c, b gives c, a, b |
| Remove empty lines too | On at first: lines with nothing in them, or only spaces, go. Off, every empty line stays where it was, and is never counted as a repeat | Off: a, empty, b, empty, a gives a, empty, b, empty |
| Inside a line | Spaces inside a line always count: New Delhi with two spaces is not New Delhi | Tidy them first with Remove Extra Spaces |
Nothing else in the text changes. The lines that stay are copied exactly; only the repeats, and the empty lines when that box is ticked, are taken out.
Real results from our tests
We tested Remove Duplicate Lines with headless Chromium 148, the open-source browser Chrome is built on, on a Windows laptop with an Intel Core i7-1185G7 and 32 GB of memory, on 1 November 2026. Other work was running on the laptop at the same time, so times vary from run to run: each time below is the middle one of 3 runs.
Removing repeats is quick. It took 44 milliseconds or less to remove the repeated lines from 500,000 characters of English, Hindi or a mix of English, Hindi, Tamil and emoji, with capital letters and the spaces at the ends of lines ignored and empty lines removed, the most the page takes at once.
After a text is put in the box, the page waits 0.15 second before it works, so a burst of typing is worked on once, and 0.4 second when the text has more than 400,000 characters. So the result of 500,000 characters of English showed between 0.95 and 1.09 second after it was put in the box in our test. A result of more than 100,000 characters shows only its first 100,000 in the box, and says so, because showing a very long text is slow for the browser; Copy and Download take all of it.
Checked against a second program. We removed the repeated lines from 1,500 random texts with this page's code and again with a separate Python program, with the three options on and off at random: the results were the same every time. The texts had English words, capitals, punctuation, repeated lines, empty lines and spaces at the ends of lines. Every example on this page is also one of our tests, run on the page's own code.
Size and offline. On a first visit the page downloads about 0.1 MB for the tool: the page, its styles, its scripts and the fonts, with Google's ad code not counted. In our test we switched the network off after the page had loaded and pressed Try a sample: the result showed 0.2 seconds later or less in each of 15 runs.
Phone-sized screen. We also ran the tests on a phone-sized screen in headless Chromium (390 × 844 pixels, with touch). That is not a real phone. Every button, box and tick box was 44 pixels high or more, and the page did not scroll sideways. These tests don't cover Safari or Firefox.
Try it yourself: press "Try a sample" at the top of this page. It puts nine lines of fruits in the box, with banana twice and an empty line. The result has 7 lines, and the page says 1 repeated line removed; the first of each is kept. Then tick Ignore capital letters: mango and apple go too.
Try the sampleKeeping the order, and which copy stays
Many tools that remove repeats sort the list first, which mixes up your order. This one doesn't. The first copy of each line stays where it was, and later copies disappear, so a list keeps its order of arrival: the first person who signed up is still first.
Because the first copy is kept exactly as written, it matters which copy comes first. With Ignore capital letters on, apple, then Apple, then APPLE leaves apple; put Apple first and Apple stays. With Ignore spaces at the ends on, a first copy with a stray space at its end keeps that space. If you want a tidy result, tidy the list first: Remove Extra Spaces takes stray spaces out, and Case Converter can give every line the same capitals.
If you want the result in alphabetical order as well, put it into Sort Lines afterwards. Sorting first and removing repeats afterwards gives the same lines, in sorted order.
Capital letters, spaces and lines that look the same
Two lines can look the same on screen and still differ. The options are there for the usual causes:
- Capital letters.
Ravi Kumarandravi kumarare the same name to a person, but different lines to a computer. Tick Ignore capital letters for names, emails and words. Leave it off for codes where capitals matter, such as some passwords or product codes. - Spaces at the ends. A line copied from a spreadsheet or a form often carries a space at its end that you can't see. Ignore spaces at the ends is on at first for that reason:
apple,appleandapplecount as one. - Spaces inside a line always count.
New Delhiwith two spaces andNew Delhiwith one are different lines. Make every run of spaces one space with Remove Extra Spaces first. - Different spellings are different lines:
colourandcolor, or9876543210and98765 43210. The tool compares characters; it doesn't guess what you meant.
Email addresses are a good case for Ignore capital letters: Ravi@Example.com and ravi@example.com almost always reach the same mailbox. Phone numbers are best tidied into one format first, without spaces, so that the same number is written the same way each time. To pull the addresses or numbers out of a longer text first, use Extract Emails.
Everyday uses
- Merge two lists without repeats. Paste one list, then the other below it, and the repeats go. The first list's lines come first.
- Clean a contact list before a bulk message or a mail merge, so nobody gets the same message twice.
- Count the repeats. The note under the result says how many repeated lines went, so you know how many items were listed twice or more.
- Tidy keywords and tags copied from several pages before you use them.
- See how much two lists share. Remove the repeats of each list on its own, then paste the two cleaned lists together: the number of repeated lines the note gives is the number of items in both lists.
To number the lines that are left, use Add Line Numbers on the result. To see how often each word of a text appears, rather than which lines repeat, use Word Frequency Counter.
Opening a text file
Choose Open a text file, or drop a file anywhere on the page, and the tool reads it on your device. These files open: .txt, .md, .csv, .tsv, .log, .json, .xml, .srt, .vtt, .html and other plain-text files, with up to 500,000 characters. The file's name and size appear below the box with an x; press the x to remove the file's text. The file is read on your device and never uploaded. The result can be copied, or saved as a new text file; the file you opened is never changed.
- Letters. A file saved as UTF-8 (a byte order mark at the start is dropped) or as UTF-16 with a mark is read correctly, Hindi and Tamil included. A file that is not valid UTF-8 is read as Windows-1252, and the page says so: "This file isn't saved as UTF-8, so it was read as Windows-1252. If letters look wrong, save it as UTF-8 and add it again."
- Windows line breaks. A Windows file stores each line break as two characters. The tool reads the pair as one line break, so two lines that look the same are found to be the same, whichever system the file came from.
- Several files. Only the first one opens, and the page says so, for example "Opening a.txt only. Open the others one at a time."
- Not a text file. A Word, PDF or picture file renamed to .txt is not read, and the page says it doesn't look like a text file. A file named .docx, .pdf or .rtf gets this message: "Only text files (.txt and similar) can be opened here. For a Word or PDF file, copy its text and paste it into the box."
- Empty or too long. An empty file says it is empty. A file with more than 500,000 characters is not opened, and the page says how many characters it has.
For a Word or PDF file, open it in the program you normally use, select the text, copy it, and paste it into the box. A PDF whose pages are scans holds pictures, not text, so there is nothing to copy.
Private: your text stays on your device
Your text never leaves your device. The tool runs inside your browser and has no upload step: it never sends the text you type, paste or open anywhere, and it keeps no copy of it, so closing the page forgets it. The page's Content Security Policy lets it contact only this site and Google's ad service, which pays for the site; our code never gives your text to the ad code. You can check it yourself in your browser's network panel (F12 on a computer): removing repeated lines adds no request that carries your text. The site's menu does remember the last few tools you opened, on your device.
Lists with repeats are often personal: phone numbers, email addresses, customer names or the entries of a register. This tool lets you clean them without handing them over. Our privacy policy says what we collect, and How we prove it shows how you can check our claims yourself.
Once the page has loaded, it also works with the internet switched off. In our test we switched the network off after the page had loaded and pressed Try a sample, and the result showed 0.2 seconds later or less in each of 15 runs.
Long texts
The tool takes up to 500,000 characters at once, about 500 KB of English text. What happens when a text is longer:
- A paste that would go over the limit is not added. This holds for Ctrl+V, for press and hold, and for the Paste button. The page says, for example: "That text is very long (550,000 characters), so it was not added. The box can hold 500,000 characters. Split it into smaller parts for faster results."
- A file with too many characters is not opened. The page says, for example: "long.txt has 550,000 characters, more than the 500,000 counted at once. Split it into smaller parts for faster results."
- A text that gets in some other way stays, unchanged. If text is dragged into the box, for example, it stays there, the result stays empty and the note says: "This text is very long (550,000 characters). Split it into smaller parts for faster results."
Removing repeats is quick. In our tests it took 44 milliseconds or less to remove the repeated lines from 500,000 characters of English, Hindi or a mix of English, Hindi, Tamil and emoji, with capital letters and the spaces at the ends of lines ignored and empty lines removed. The slow part is the browser showing a very long text in a box, so a result of more than 100,000 characters shows only its first 100,000, without cutting an emoji in half, and the note says so, for example "Showing the first 100,000 of 164,999 characters. Copy and Download take all of it." Copy and Download always take the whole result.
Tips
- One item to a line. If your items are separated by commas, put each on its own line first with Find and Replace, replacing each comma and space with
\n. - Tidy before you compare. Remove Extra Spaces makes spaces inside lines the same, so two copies of a name with different spacing count as one.
- Turn on Ignore capital letters for names, words and emails; leave it off for codes.
- Put the best copy first if the copies differ in capitals or spaces, because the first one stays.
- Sort afterwards with Sort Lines if you want the cleaned list in alphabetical order.
- Keep your own copy. The page forgets everything when you close it.
Limits
- Whole lines only. It removes repeated lines, not repeated words inside a line or repeated sentences inside a paragraph.
- Characters, not meanings. Different spellings or formats of the same thing are different lines.
- Spaces inside a line count. Tidy them first if they differ.
- No columns. For a table, it compares whole rows; to remove rows with the same value in one column, use a spreadsheet.
- 500,000 characters at once, about 500 KB of English text.
- Text only. It doesn't open Word, PDF or spreadsheet files: copy their text first.
Terms explained
- Duplicate
- A line that has already appeared earlier in the text.
- First copy
- The earliest line of a group of lines that count as the same. It is the one that stays.
- Case
- Whether a letter is a capital or small. Ignoring case makes Apple and apple the same.
- Trailing space
- A space at the end of a line, often invisible on screen.
- Empty line
- A line with nothing in it, or only spaces and tabs.