Xerobit

CSV Remove Duplicates: Deduplicate Rows Instantly

Paste your CSV data below to remove duplicate rows while preserving the original order. The parser follows RFC 4180, so it correctly handles quoted fields, embedded commas and newlines inside cells. Everything runs in your browser and nothing is uploaded to any server.

Paste your CSV here. Quoted fields and embedded newlines are supported.

Character separating columns.

Keeps the first row at the top and excludes it from deduplication.

Result

  • Total rows
    0
  • Unique rows
    0
  • Duplicates removed
    0

By · Published · How we build and test tools

How to use the csv remove duplicates

  1. Paste your CSV data into the text area or type it directly.
  2. Select the correct delimiter if your data uses tabs, semicolons or pipes instead of commas.
  3. Check First row is header if your data has column names that should stay at the top.
  4. The deduplicated output appears instantly below as you type.

How the RFC 4180 parser works

To csv remove duplicates reliably, the tool cannot just split lines on newline characters. A field wrapped in double quotes may contain commas, newlines and even double-quote characters (escaped by doubling them). The parser reads character by character following RFC 4180 rules:

  • A field starting with a double quote continues until a closing double quote is found.
  • Two consecutive double quotes inside a quoted field represent a single literal quote.
  • Commas and line breaks inside quoted fields are part of the cell value, not delimiters.

For example, the input "Smith, John","line1 line2" parses as two fields: Smith, John and line1\nline2. Row comparison uses these parsed values, so two rows that look different in raw text but parse identically are treated as duplicates.

Deduplication logic

After parsing, each row is converted to a canonical string by serialising its parsed field values as a JSON array, so no combination of cell contents can collide. This canonical form is used as a key in a set. When a row's key already exists in the set, it is skipped. Otherwise, it is kept and its key is added to the set.

This approach preserves the original order of first occurrence. If the header option is enabled, the first row is always emitted and excluded from the deduplication set, ensuring column names are never accidentally removed even if a data row happens to match them.

Comparison is exact and case-sensitive: Alice and alice are different rows, as are values that differ only by a trailing space. Completely blank lines are skipped, so they never appear in the output.

Handling ragged rows

A well-formed CSV file has the same number of fields in every row. When the parser encounters rows with different field counts, it flags them as ragged. Ragged rows are still processed and deduplicated based on their actual content, but a Column check card reading "Ragged rows detected" is added to the results.

If you see ragged row warnings, check whether your delimiter setting matches the data, or whether some fields are missing quotes around embedded delimiter characters. You can inspect the data further using a csv viewer.

Common use cases

Deduplicating CSV data comes up frequently when combining exports from multiple systems. For instance, merging contact lists often produces repeated entries. After you csv remove duplicates here, you might need to convert the result to another format. Tools like csv to json or csv to ascii table can help reshape the clean data for APIs or documentation.

If your source data starts as JSON, you can first use json to csv conversion, then deduplicate, and finally export back. For tab-separated files, simply switch the delimiter to Tab before pasting.

Output formatting

The cleaned CSV is re-serialized following RFC 4180 conventions. Fields that contain the chosen delimiter, double quotes or newline characters are automatically wrapped in double quotes, and any internal double quotes are escaped by doubling them. Rows are joined with CRLF (\r\n) line endings, which is the standard for CSV interchange.

This means the output is safe to save as a .csv file and open in spreadsheet applications without import issues. If you need to split large results into smaller files afterward, consider a csv splitter.

Worked examples

ExampleInputResult
Simple duplicatesCSV data: name,email / Alice,a@ex.com / Bob,b@ex.com / Alice,a@ex.com; Delimiter: ,; First row is header: yesTotal rows: 3; Unique rows: 2; Duplicates removed: 1
Quoted fields with commasCSV data: name,address / "Smith, John","123 Main St" / "Doe, Jane","456 Oak Ave" / "Smith, John","123 Main St"; Delimiter: ,; First row is header: yesTotal rows: 3; Unique rows: 2; Duplicates removed: 1
Embedded newlinesCSV data: id,note / 1,"line one / line two" / 2,simple / 1,"line one / line two"; Delimiter: ,; First row is header: yesTotal rows: 3; Unique rows: 2; Duplicates removed: 1
No header rowCSV data: apple,1 / banana,2 / apple,1 / cherry,3; Delimiter: ,; First row is header: noTotal rows: 4; Unique rows: 3; Duplicates removed: 1

FAQ

Does this tool handle CSV fields that contain commas?

Yes. The parser follows RFC 4180, so any field wrapped in double quotes can contain commas, and they will be treated as part of the field value rather than as column separators.

What about newlines inside CSV cells?

Newlines inside double-quoted fields are preserved as part of the cell content. Two rows with identical multi-line cell values are correctly identified as duplicates.

Is my data sent to a server?

No. All parsing and deduplication happens locally in your browser. Nothing is uploaded anywhere.

Can I use a tab or semicolon as the delimiter?

Yes. Select Tab, Semicolon or Pipe from the delimiter dropdown. The parser and deduplication logic adapt to whichever character you choose.

What does 'ragged rows' mean?

It means some rows have more or fewer fields than the first row. The tool still processes them and shows a "Ragged rows detected" card, because inconsistent column counts often indicate a delimiter or quoting problem.

Will the header row ever be removed as a duplicate?

No. When the header option is checked, the first row is always kept at the top and is excluded from the deduplication comparison.