Skip to main content

CSV deduplication guide

How to remove duplicate rows from a CSV safely

A duplicate is only meaningful after you choose the comparison rule. Compare every column for exact duplicate rows, or select keys such as Order ID. For each matching key, Maskedcsv keeps the first row in input order.

Published:

Updated:

Related tool: Remove duplicates

Example: one row per order

An export contains Order ID O-102 twice. If the newest row should survive, sort by Updated at descending before deduplicating.

  • Comparison key: Order ID
  • Case-sensitive comparison
  • Keep the first occurrence

Input with a repeated order

Read both O-102 records across all four columns. They match exactly. In an order export with one row per product, the same order ID can also appear on different line items. In that case, compare all columns or include the line-item ID in the key.

orders.csv
Order ID,Customer,Amount,Status
O-101,Northstar Labs,128.00,Paid
O-102,Maple Supply,84.00,Paid
O-102,Maple Supply,84.00,Paid
O-103,Harbor Foods,62.00,Pending

CSV after deduplication

Here four data rows become three. Try changing only the status in the second O-102 on a copy. Comparing all columns then keeps both versions. Comparing Order ID keeps the earlier row in the file, even if the later one has the status you need.

orders_deduplicated.csv
Order ID,Customer,Amount,Status
O-101,Northstar Labs,128.00,Paid
O-102,Maple Supply,84.00,Paid
O-103,Harbor Foods,62.00,Pending

Remove duplicates in five steps

Keep the original file until you have reviewed the result.

  1. Open Remove duplicates and choose one CSV up to 500 MB.
  2. Confirm the encoding, delimiter, headers, and preview.
  3. Compare all columns or select one or more key columns.
  4. Choose whether letter case matters, then run the operation.
  5. Before downloading, confirm every input row is either kept or removed as a duplicate.
Remove duplicates

Verify the rows that remain

Confirm that three of the four input rows remain and one was removed, then sample the result to make sure the right row remains.

  • Every input row is either kept or removed as a duplicate
  • The first row for a repeated key remains
  • Blank keys compare equal to other blank keys
  • Spaces and look-alike characters written in different forms are not changed

Common deduplication mistakes

Deduplication does not perform fuzzy matching or clean inconsistent values.

  • Using Customer Name alone and removing different customers
  • Treating O-102 and o-102 as equal while case sensitivity is on
  • Leaving trailing spaces that create separate keys
  • Expecting the latest row to remain without sorting first

When to use this tool

Use deduplication to reduce repeated rows. Use Filter rows for a condition, or Merge CSV files to stack separate exports.

  • Good fit: consistent order or customer IDs
  • Good fit: fully identical rows
  • Sort first: control which version remains
  • Not a fit: fuzzy name or address matching