How to remove duplicate rows in a CSV
Load the file into the CSV Cleaner, trim whitespace FIRST, then remove duplicate rows. The first occurrence of each row is kept and later copies are removed, so the order of the data you keep does not change.
The ordering of those two steps is the whole trick. Two rows differing only by a trailing space are not duplicates to a computer, so deduplicating before trimming leaves both in place and then reports a job well done.
Last reviewed: 2026-09-19. Checked against the tool’s own source on that date.
Why "identical" rows survive deduplication
Trimming addresses the first and the last of these directly. The others need a decision from you, which is why they are not silently normalised — folding case, for example, is correct for email addresses and wrong for product codes, and a tool cannot tell which column is which.
- Trailing or leading spaces. Invisible in a spreadsheet, decisive to a comparison.
- Case differences. ann@example.com and Ann@example.com are different strings, even though they are the same mailbox.
- Different quoting. "Smith, John" and Smith\, John can carry the same value and differ byte for byte before parsing.
- Non-breaking spaces. Copy-pasting out of a web page or a PDF frequently substitutes U+00A0 for a normal space, and nothing about it looks unusual.
- A trailing empty column. One export writes four fields, another writes four fields and a trailing delimiter.
The order that works
Each of those steps is separately undoable, up to the last twenty operations, so there is no cost to trying one and reversing it.
- Load the file and confirm the delimiter and column count are right. Deduplicating a file that parsed as one column does nothing useful.
- Trim whitespace on every cell.
- Remove empty rows if the export has them, so they do not collapse into a single retained blank.
- Remove duplicate rows.
- Check the row count before and after. The difference is how many duplicates there were.
Whole-row duplicates, not duplicate keys
This removes rows that are identical across every column. That is not the same as removing rows that share a key.
If the same customer appears twice with different signup dates, those are not duplicate rows — they are two different records that happen to share a name. Removing one would be deleting data, and the tool will not do it on a guess.
To deduplicate by a key, reduce the export to the columns that define the key, deduplicate that, and use the result as a lookup list. Or do the join in a spreadsheet or a database, which is where that kind of decision belongs.
Deduplicating a single column of values
If your actual problem is a list — email addresses, SKUs, URLs — rather than a table, the Text Toolkit is the faster route. It deduplicates lines, trims them and sorts them, and it takes a paste rather than a file.
The same ordering rule applies there: trim first, then deduplicate.
Worked example: a mailing list merged from three exports
Three exports have been concatenated into one 4,812-row file with a Name, Email and Source column. Some contacts appear in more than one source, and the file was assembled by copy-paste, so some rows have trailing spaces.
Removing duplicates straight away reports 118 removed — suspiciously few for three overlapping lists.
- Undo the deduplication.
- Trim whitespace on every cell.
- Remove duplicate rows again.
- Compare the row count against the original.
Result: The second pass removes substantially more rows than the first, because trimming made the real duplicates identical. Rows that share an email address but differ in the Source column are correctly still present — they are not identical rows, and deciding which Source wins is a judgement the tool leaves to you.
Open the tool
Deduplicate a CSV in your browser
Removes rows identical across every column, keeping the first. It will not guess which of two similar records you meant to keep.
What this does not cover
- Only whole-row duplicates are removed. Deduplicating by a key column is not something this tool does.
- Case is significant. ANN@example.com and ann@example.com are kept as two rows.
- The first occurrence is kept. There is no option to keep the last.
- The whole file is held in memory, capped at 50 MB.
- Undo is limited to the last 20 operations.
- Only the first 100 rows appear in the preview, so confirm results by the row count rather than by scrolling.