CSV Cleaner
Trim whitespace, drop empty rows, and de-duplicate CSV data.
Delimiter
Cleaned CSV
4 rows kept · 3 removed
Clean messy CSV files instantly
Exported spreadsheets are full of stray spaces, blank rows, and duplicate records that break imports. This cleaner parses your data with a proper CSV reader — so quoted fields containing commas stay intact — then trims each cell, removes empty and duplicate rows, and re-serializes valid CSV. Choose your delimiter and whether the first row is a header (which is always preserved). Your file never leaves your browser.
Built and maintained by Meet Shah · Last updated
What this tool is used for
- Trimming stray whitespace from an export before importing it, where a trailing space breaks a match.
- Removing the blank rows a spreadsheet export leaves at the end of a file.
- Deduplicating rows that appear twice after a merge.
- Normalising a file assembled from several sources before analysis.
- Preparing a file so a strict importer accepts it on the first attempt.
Frequently Asked Questions
- What does the deduplication actually compare?
- The full row, serialised so that field boundaries survive the comparison. Joining cells with a space would collide — ["a b", "c"] and ["a", "b c"] both flatten to "a b c", so one genuinely distinct row would be dropped as a duplicate. Comparison happens after trimming, if trimming is on.
- Is the header row protected?
- Yes, when Has header is on. It is lifted out before cleaning and put back afterwards, so it is never deduplicated against the body and never removed as an empty row. Turn the option off for headerless data, or a genuine first record gets treated as labels.
- Why are quotes reappearing in the output?
- Because a field is re-quoted whenever it needs to be — if it contains the delimiter, a double quote, or a line break, RFC 4180 requires wrapping it and doubling any internal quotes. Fields that no longer need protection after trimming come out bare.
- What counts as an empty row?
- One whose every field is empty or whitespace, so a line of just commas is dropped along with a genuinely blank line. A row with one populated field and five blanks is kept — that is sparse data, not an empty record.
- Should I trim whitespace?
- Almost always, and know what it costs. Trimming fixes the leading space that spreadsheets add after a comma, which otherwise makes " Ada" and "Ada" distinct keys in every later join. It also destroys deliberately padded fixed-width values, so leave it off for data whose alignment is meaningful.
Common errors and gotchas
- Trimming whitespace that was significant, such as a leading space in a deliberately padded code.
- Deduplicating on the whole row when the duplicate differs in one irrelevant column.
- Removing rows that look empty but carry a single meaningful value.
- Losing the header while dropping empty rows if the header is separated by a blank line.
- Assuming case-insensitive deduplication, or assuming it is case-sensitive, without checking which.
Related Converters tools
JSON to YAML
Convert JSON into clean, readable YAML instantly.
YAML to JSON
Convert YAML configuration into valid JSON.
JSON to XML
Convert JSON structures into nested XML markup.
HWB to HEX Converter
Convert an HWB color to HEX.
JSON to SQL
Turn a JSON array of objects into SQL INSERT statements.
CSV to XML
Convert CSV rows into structured XML records.
XML to CSV
Flatten repeated XML records into CSV rows.
INI to JSON
Parse INI config sections and keys into JSON.