How to remove duplicate lines
- Paste your list into the box on the left, or press Open a file to load a .txt or .csv file, one item per line: email addresses, names, product codes, keywords, links or any other text. A column copied from a spreadsheet pastes the same way.
- The result appears on the right while you type. Each line is kept the first time it appears, later copies are removed, and the lines stay in their original order.
- Choose what to keep under Keep: the first copy, the last copy, only the lines that appear once, or only the lines that are repeated.
- Tick the options you need: ignore capital letters, ignore spaces at the ends, remove empty lines or sort the result A to Z.
- Press Copy to paste the clean list somewhere else, or Download .txt to save it.
When two lines count as the same
By default, two lines are duplicates only when they match exactly, character for character. That is the safe choice for things where capitals matter, such as passwords, codes and file names on Linux. Two options loosen the match:
- Ignore capitals treats “Apple”, “apple” and “APPLE” as one line. This suits email addresses, which almost every mail service treats the same whatever the capitals, and names typed by different people. The copy that is kept shows its own spelling.
- Ignore spaces at the ends treats “cherry” and “cherry ” with a trailing space as one line. Stray spaces are common in lists copied from spreadsheets and web pages, and they are invisible, so this is on by default. The kept lines have those spaces taken off.
Spaces between words always count, so “New York” and “NewYork” stay different, and so do accented letters: “resume” and “résumé” are not duplicates.
Keep the first copy, the last copy, or neither
- The first copy is what most people want: the list keeps its order, and each line stays where it first appeared.
- The last copy keeps each line where it last appeared. This helps with logs and lists that are added to over time, where the latest entry is the one that matters.
- Only lines that appear once removes every line that has a copy, including the first one. Use it to find the entries that are in one list but not the other: paste both lists one after the other, and the lines left are the ones that appear in only one of them.
- Only the repeated lines lists each line that appears more than once, one time each, so you can see what was entered twice.
Seeing what was repeated
The Repeated lines table under the tool lists every line that appears more than once, with how many times it appears and the line numbers where it appears, the most frequent first. Line numbers count every line you pasted, empty ones included, so they match the line numbers in a text editor or a spreadsheet row number when the list starts in row 1. It is a quick way to count votes or survey answers, find the keyword that turns up most often, or check which customer was entered several times before you remove the copies. The count above the box shows how many lines you pasted, and the message under the buttons says how many were removed.
Removing duplicates in Excel, Google Sheets and on the command line
- Excel: select the column, then on the Data tab press Remove Duplicates. Newer versions of Excel also have the
=UNIQUE(A1:A100)function, which lists each value once without changing the original column. - Google Sheets: select the range and choose Data, Data cleanup, Remove duplicates, or use
=UNIQUE(A1:A100). - Notepad++: choose Edit, Line Operations, Remove Duplicate Lines.
- Linux and macOS terminal:
sort -u file.txtremoves duplicates but sorts the lines.uniqonly removes copies that sit next to each other, so it is usually run aftersort. To keep the original order,awk '!seen[$0]++' file.txtkeeps the first copy of each line.
Pasting the list here is quicker for a one-off job, works on a phone, keeps the order, and shows the repeat counts that those commands do not.
When removing duplicate lines helps
- Email and contact lists: merge lists from several sign-up forms and remove the addresses that appear twice before you send a message, so nobody gets it twice.
- Keyword and hashtag lists: combine ideas from several sources into one clean list.
- Product codes, order numbers and inventory: find codes entered twice by mistake.
- Links and file names: clean a list of web addresses before checking or downloading them.
- Class lists and sign-up sheets: remove names that signed up more than once, then sort them with alphabetical order.
To remove line breaks instead of lines, use remove line breaks. To compare two versions of a text side by side, try text compare, and to put a list in a random order, the list randomizer.
Tips
- Check the repeat table before you copy. If a line you expected to be removed is not in it, the two copies differ somewhere, often in capitals or an extra space between words.
- Tick Ignore capitals for email addresses. At almost every mail service, “Ann@Example.com” and “ann@example.com” reach the same inbox.
- Empty lines count as lines. With Remove empty lines unticked, an empty line is treated like any other line, so only the first one is kept. For text with gaps between paragraphs, such as song lyrics, check the spacing afterwards.
Your list stays on your device
Repeated lines are found in your browser, and your text is never uploaded to this website or anyone else, so it is safe to use with email lists and customer data. Only your settings are remembered on this device; the text is gone when you close the page.
Frequently asked questions
How do I remove duplicate lines?
Paste your text into the box, one item per line, and the lines without repeats appear next to it straight away. The first copy of each line is kept in its place and later copies are removed. Press Copy or Download .txt to keep the result.
Does it treat “Apple” and “apple” as the same line?
Only if you tick “Ignore capitals”. By default lines must match exactly, letter for letter, to count as duplicates, which is safer for codes and passwords. With the box ticked, the spelling of the copy that is kept is shown.
What about spaces at the start or end of a line?
With “Ignore spaces at the ends” ticked, which is the default, “cherry” and “cherry ” followed by a space count as the same line, and the result has the extra spaces taken off. Spaces between words always count.
Can I keep only the lines that are not repeated?
Yes. Choose “Only lines that appear once” and every line that has a copy is removed completely, copies and all. Choose “Only the repeated lines” to get the opposite: one copy of each line that appears more than once.
How do I see how many times each line repeats?
The table under the result lists every repeated line with the number of times it appears and the numbers of the lines it is on, most frequent first. It shows the first 50 repeated lines and says how many more there are.
Is my text uploaded?
No. Repeated lines are found in your browser, and your text is never sent to this website or anyone else. Only your settings are saved on this device.