csvkit.org
CSV (Comma-Separated Values) utilities, in the browser
Say hi →

Trim Whitespace in a CSV

edge spaces · double spaces · zero-width characters · NBSP · empty rows and columns

Clean the whitespace you can't see. Leading and trailing spaces break exact joins, grouping, and deduplication while looking completely normal on screen — and text pasted from a web page or a PDF often carries non-breaking spaces and zero-width characters that behave like invisible letters. This strips all of it, cell by cell, and reports how many cells changed.

trim
Or drop a .csv file here, or
ready

How to trim a CSV

  1. Paste the CSV or drop a file. The three most common fixes are already ticked.
  2. Add collapse double spaces for text that was manually typed or line-wrapped.
  3. Add the drop options if the file has trailing empty rows or columns from a spreadsheet export.
  4. Check the report in the status line, then copy or download.

The characters this removes

Clean the header names too

A header with a trailing space is especially nasty: your column is "email ", every reference to email silently returns nothing, and the file looks perfect. That option is on by default. A BOM on the very first header is the same class of problem — Encoding & BOM handles that one.

FAQ

Will this change values I care about?

Only whitespace and invisible characters. Visible text, punctuation, and casing are untouched — use Find & replace for those.

Does it trim inside quoted fields?

Yes — trimming works on parsed cell values, so quoting doesn't hide anything. Output is re-quoted properly.

How do I know it actually did something?

The status line counts changed cells and separately reports how many contained invisible characters, so you can tell whether the problem was really whitespace.

Is anything uploaded?

No. It all runs in your browser.

Privacy

100% client-side. No upload. See the privacy policy.