How to clean a CSV file
- Paste CSV, drop a file on the input box or click Open file. Messy sample shows what the cleaner can fix.
- Tick the fixes you want. The clean CSV and the report update immediately.
- Read the report, then copy or download the result, or open it in the viewer.
What each option does
- Trim and normalize whitespace
- Removes spaces at the edges of cells (and stray quotes left by a space before an opening quote), collapses runs of spaces, and replaces non-breaking spaces that break lookups.
- Empty rows and columns
- Drops rows where every cell is blank, and columns with no value in any data row, even if they have a header.
- Ragged rows
- Short rows get empty cells so every row has the header's width. Rows with extra cells either get new columns, so nothing is lost, or lose the extras.
- Byte order marks
- Strips the invisible U+FEFF character some programs put before the first header, and stray copies inside cells.
- Line endings
- Writes every line break, including the ones inside quoted cells, as LF or CRLF.
- Header names
- Changes case (snake_case is handy for databases), names empty headers column_1, column_2 and so on, and appends _2, _3 to duplicates.
Frequently asked questions
What counts as an empty row or column?
A row is empty when every cell is blank or only whitespace. A column is empty when none of its data cells has a value; a header name alone does not keep it. The report lists which rows and columns were removed.
What is a ragged row?
A row with more or fewer fields than the header, usually caused by an unquoted comma or a cut-off line. Short rows are padded with empty cells. Long rows either get extra columns or have their extra cells dropped, and the report shows the row numbers either way.
Why remove the byte order mark?
Some programs write an invisible byte order mark at the start of UTF-8 files. Many importers then read the first column name as a different word than the one you see, so lookups like id fail. Removing it fixes that.
Which line endings should I pick?
CRLF if the file is going to Excel or another Windows program, LF for most databases, scripts and Unix tools. The choice applies to line breaks inside quoted cells too, so the whole file is consistent.