Data Tools
CSV Cleaner and Whitespace Trimmer
Clean messy CSV in your browser: trim spaces around fields, drop blank rows, empty columns and duplicate rows, and keep quoted fields and the delimiter intact.
How to use CSV Cleaner and Whitespace Trimmer
Paste your CSV into the box and the cleaned version appears as you type. Leave the delimiter on automatic or pick comma, semicolon, tab or pipe, tick the clean-up options you need, then press Copy result.
- Paste the CSVPaste your data into CSV to clean. The delimiter is detected automatically unless you choose one.
- Choose clean-up optionsTick options such as Remove blank rows, Remove empty columns or Remove duplicate rows; the result updates instantly.
- Check the summary and copyRead the row and column count and any warnings under the result, then press Copy result.
What the cleaner changes: a worked example
Fields are split by CSV rules first, so a comma inside double quotes stays in its field and a space before an opening quote is tolerated. In the sample, a row holding Alice, "Beijing, China" and 30 padded with spaces and followed by two empty fields becomes Alice,"Beijing, China",30: spaces around each field are trimmed, the quoted field keeps its quotes because it contains a comma, and the two empty trailing columns are dropped. Inner spaces are kept unless you tick Collapse repeated spaces inside fields, which turns runs of spaces or tabs into one. Zero-width spaces, soft hyphens and a byte order mark are stripped too, and the note counts cleaned fields, removed rows and removed columns.
Empty columns, duplicates and uneven rows
A column is removed only when it is blank in every row, header included, so a named column with no data yet is kept. Duplicate rows must match exactly after cleaning, and the first copy is kept. When some rows have fewer fields than the widest row, a warning says how many; tick Pad short rows to full width to add empty fields at the end. An unclosed double quote makes the parser read everything after it as one field, and a warning gives the line where the quote opened so you can fix the source file. Fields that contain the delimiter, a quote or a line break are quoted again in the output.
Accuracy and data handling
Keep the original data and spot-check fields, types and delimiters before using an important conversion. The calculation runs in your current browser; the tool code does not send the input to a processing API.
FAQ
How do I remove spaces from CSV fields?
Paste the CSV and leave Trim spaces around fields ticked. Leading and trailing spaces and tabs are removed from every field as you type, while spaces between words inside a field are kept.
Does it handle quoted fields with commas?
Yes. Quoted fields are parsed by CSV rules, so commas, semicolons and line breaks inside quotes stay in one field. On output, fields containing the delimiter, a quote or a line break are quoted again, with inner quotes doubled.
Can I clean a semicolon or tab-separated file?
Yes. Comma, semicolon, tab and pipe are detected automatically, or you can choose one yourself. The cleaned output keeps the same delimiter as the input.
Is my CSV uploaded anywhere?
No. The cleaning runs in your browser, so the data you paste is not sent to a server for processing.
More Data Tools
Related toolsConvert CSV or spreadsheet cells into Markdown, HTML or ASCII table code.
Convert file sizes and estimate how long a transfer takes at any speed.
Pull values out of JSON with JSONPath: wildcards, slices and filters.
Create a JSON Schema from example JSON, with types, formats and required keys.
Validate, pretty-print or compact JSONL and convert it to or from a JSON array.
Convert XML to JSON with attributes and repeated elements, or JSON back to XML.