How to use
Paste your list
Put one item per line in the Your list box, or press Try sample to load a short keyword list that has repeats, mixed capitals and a trailing space.
Choose what to keep
In What to do, keep one copy, keep only lines that appear once, or show only duplicates, and pick the first or last copy. Tick Ignore case if Apple and apple should match.
Check the counts and copy
Read the lines in, out and removed counter, and check the Lines that repeated table and the Removed lines box below. Then press Copy, or Download .txt to save the clean list.
Why Remove Duplicate Lines
- Keeps the first or last copy of each line where it was, so your order stays intact.
- Can keep only unique lines, or list only the duplicated ones.
- Works on lines or on comma, tab or custom separated items.
- Lists removed lines and repeat counts, and runs in your browser.
Before and after: cleaning a keyword list
Here is the ten-line sample list with default settings: case-sensitive matching, spaces at the ends ignored, blank lines kept. The line "running shoes " has a trailing space, so it matches "running shoes" and is removed. "Running Shoes" stays because its capitals differ.
Tick Ignore case and Remove empty lines and the output shrinks to four lines: running shoes, trail running shoes, running shoes for flat feet and waterproof trail shoes. The repeated lines table then reports running shoes as found 4 times.
| Input line | Default result | With Ignore case and Remove empty lines |
|---|---|---|
| running shoes | Kept (first copy) | Kept (first copy) |
| trail running shoes | Kept | Kept |
| Running Shoes | Kept (capitals differ) | Removed |
| running shoes for flat feet | Kept | Kept |
| (blank line) | Kept | Removed |
| trail running shoes | Removed | Removed |
| running shoes (with a trailing space) | Removed | Removed |
| (blank line) | Kept | Removed |
| waterproof trail shoes | Kept | Kept |
| running shoes | Removed | Removed |
How to remove duplicate lines in Excel, Notepad++ and the command line
If the text already lives in another program, these built-in options do the same job. Note which ones keep your original order, because several of them sort the list as a side effect.
- Excel: select the column, then Data, Remove Duplicates. It keeps the first copy of each value. In Excel 365, =UNIQUE(A2:A500) returns the list without repeats in a new range.
- Google Sheets: Data, Data cleanup, Remove duplicates, or the =UNIQUE() formula.
- Notepad++: Edit, Line Operations, Remove Duplicate Lines. There is also Remove Consecutive Duplicate Lines, which only removes repeats that sit next to each other.
- Linux and macOS: sort -u list.txt removes repeats but sorts the list. uniq on its own only removes adjacent repeats, so it is normally used after sort.
- To keep the original order on the command line, use awk '!seen[$0]++' list.txt, which prints each line the first time it appears.