Skip to content
PithLab

↑↓ to move · Enter to open · Esc to close

CSV Cleaner: Trim, Dedupe and Fix CSV Files

Trim, dedupe and tidy CSV files, with a report of every change.

Use via API

Clean CSV: trim cells, drop empty rows and columns, remove duplicate rows, rename headers, fix ragged rows and drop columns. Returns the cleaned CSV and a report of what changed. Send JSON, get JSON back.

POST https://pithlab.com/api/v1/tools/csv-cleaner

curl https://pithlab.com/api/v1/tools/csv-cleaner \
  -H "Authorization: Bearer $PITHLAB_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":" Name , Email \nAda, [email protected] \n\nAda,[email protected]\nAlan,[email protected]","removeDuplicates":true,"headerStyle":"snake"}'

Fields and responseOpenAPI documentGet an API key

About the CSV Cleaner

Clean messy CSV in your browser. Trim cells, drop empty rows and columns, remove duplicates, tidy header names, fix ragged rows and change the delimiter.

How to use the CSV Cleaner

  1. Paste your CSV, or press Example to load a messy sample.
  2. Tick the clean-up steps you want, such as trimming cells, removing empty rows or removing duplicates.
  3. To find duplicates by certain columns only, tick those columns under Duplicate key columns. Leave them all unticked to compare whole rows.
  4. Tick any columns under Remove columns to drop them, and pick an output delimiter if you need a different one.
  5. Check the report of what changed, then copy the result or download it as a .csv file.

Examples

Trim, remove the empty row and column, dedupe and snake_case the headers

Input

 Name , Email ,Notes
 Ada ,[email protected],

Ada,[email protected],
Grace,[email protected],

Output

name,email
Ada,[email protected]
Grace,[email protected]
Semicolons to commas, fit rows to the header and dedupe by email ignoring case

Input

id;email;city
1;[email protected];London
2;[email protected];Paris;extra
3;[email protected]

Output

id,email,city
1,[email protected],London
3,[email protected],

Frequently asked questions

Which duplicate is kept?

The first one. Later rows with the same values (or the same values in the key columns you picked) are removed, so the original order of the remaining rows is kept.

What counts as an empty row or column?

A row is empty when every cell is blank or only spaces. A column is empty when every data row has nothing in it, even if the column has a header name.

What do pad and fit do for ragged rows?

Ragged rows have more or fewer cells than the others. Pad adds empty cells so every row is as wide as the widest row, losing nothing. Fit pads short rows and cuts long rows to the width of the first row.

How are header names normalised?

snake_case lowercases words and joins them with underscores, so "First Name" and "firstName" both become first_name. Title Case gives "First Name". Accents are removed, and repeated names get a number so every header stays unique.

Is my file uploaded anywhere?

No. The CSV is parsed and cleaned in your browser, so the data never leaves your device.