CSV Whitespace Normalizer

Trim every cell and fix the spaces inside your values — non-breaking spaces from a spreadsheet paste included — so joins, lookups and duplicate checks stop failing on padding you cannot see.

Try:
Normalized CSV

About this tool

Stray whitespace is the quietest way for a CSV to be wrong. Berlin and Berlin are different keys, so a join drops rows, a VLOOKUP returns #N/A, a GROUP BY splits one city into two, and a duplicate check finds nothing to merge — all while the spreadsheet on screen looks perfectly fine, because a space renders as nothing.

A plain trim only fixes half of it. Trimming turns " Ada Lovelace " into "Ada Lovelace" and leaves the three spaces in the middle, so the value still does not match Ada Lovelace. This tool handles both ends and the interior: it collapses runs of whitespace inside a value down to a single space, or removes them outright when the value is a SKU, an IBAN or a part number that should have no spaces at all.

It works on the parsed table, not on the raw text. Fields are read with a real RFC 4180 parse, so quoted values keep their quoting, an embedded comma or newline never breaks a record, the field separator round-trips unchanged, and a ragged row keeps its length. Only whitespace changes — nothing is retyped, reordered, dropped, or invented.

Worked example

Input (defaults everywhere — the dots below mark the spaces you cannot see):

name,city,sku
··Ada···Lovelace·,·New···York·,··AB·12··CD·
Grace Hopper,Berlin·,XY34

Output:

name,city,sku
Ada Lovelace,New York,AB 12 CD
Grace Hopper,Berlin,XY34

Row 3 shows what "already clean" looks like: Grace Hopper keeps its single space, and only the stray one after Berlin goes. If you also wanted AB 12 CD to become AB12CD — but only in that column — set Whitespace inside the value to Remove and Only these columns to sku.

The invisible ones

By default whitespace means the whole Unicode White_Space set, not just space and tab. That matters because the characters a spreadsheet, a PDF, or a web page leaves behind on copy-paste are usually not plain spaces:

charactercode pointwhere it comes from
non-breaking spaceU+00A0HTML  , Word, thousands separators in European locales
narrow no-break spaceU+202Ftypographic thin spacing, French punctuation
ideographic spaceU+3000CJK text and CJK-locale spreadsheets
en / em spaceU+2002 / U+2003typeset documents

All of them are trimmed and collapsed like an ordinary space. Switch What counts as whitespace to ASCII only when a non-breaking space is load-bearing in your data and must survive.

Zero-width characters are deliberately not included: U+200B (zero-width space) and U+FEFF (BOM / zero-width no-break space) have White_Space=No, they are not padding, and stripping them is a different job with different consequences.

Controls

Limits and edge cases

The table is capped at 5,000,000 bytes. A cell that is only whitespace becomes empty under every trim setting except none. Under collapse, a newline embedded inside a quoted cell counts as a whitespace run and becomes one space, which is usually what you want but does flatten a deliberately multi-line cell — choose keep to preserve it. A column selector token that parses as a number or a range is read as a position, so a header literally named 3 or 2-4 has to be selected by its position instead of its name. Output rows are terminated with a single newline (\n) and the result always ends with one. Everything runs locally in your browser — the table is never uploaded.

FAQ

How is this different from just trimming each cell?

Trimming only touches the two ends. " Ada Lovelace " trims to "Ada Lovelace", which still will not match "Ada Lovelace" in a join or a duplicate check. This tool also rewrites the whitespace between the first and last non-whitespace character — collapsing each run to one space, or deleting it. Set Whitespace inside the value to Keep if a plain trim is genuinely all you want.

My spaces look normal but the tool still changes them — why?

They are probably not spaces. A copy-paste out of a spreadsheet, a PDF, or a web page routinely brings along U+00A0 (non-breaking space), U+202F, or U+3000, all of which render identically to a space and none of which a TRIM() or a strip() on ASCII whitespace will touch. That is precisely the case this tool is built for. If those characters are meaningful in your data, switch What counts as whitespace to ASCII only.

Will it break quoted fields, embedded commas, or multi-line cells?

No. The table is parsed as real CSV before anything is rewritten, so a quoted "Boston, MA" stays one field and comes back out quoted, and a cell containing a newline stays one cell. The one thing to know: an embedded newline is whitespace, so under collapse it becomes a single space and the cell ends up on one line. Choose keep for the interior if you need multi-line cells preserved exactly.

Can I clean only some columns?

Yes — put names, 1-based positions, or inclusive ranges in Only these columns, e.g. email,city, 2, or 1,3-5. Every other column is copied through untouched, so you can strip every space out of a SKU column without also welding shut the free-text notes next to it. Names need First row is a header switched on.

Does it change anything other than whitespace?

No. Values are not retyped, rounded, re-cased, or re-quoted beyond what the CSV grammar requires; rows are never added, dropped, or reordered; a short row stays short; and the delimiter you fed in is the delimiter you get back. Missing-value tokens, header naming, and duplicate rows are separate jobs with separate tools — this one only moves whitespace.

Does my file get uploaded?

No. The whole pass is compiled to WebAssembly and runs in the page, so the table never leaves your browser. For a file on disk you can run the same code offline from the terminal: gizza tool csv-whitespace-normalizer input="$(cat data.csv)".

Developer & Automation Access

Run it from the terminal

Same engine as this page, headless — via the gizza CLI:

gizza tool csv-whitespace-normalizer "name,city,sku
  Ada   Lovelace , New   York ,  AB 12  CD 
Grace Hopper,Berlin ,XY34"

New to the CLI? Get gizza →

Open it by URL

Pre-fill and auto-run this tool with query parameters — the names match the API/CLI:

https://gizza.ai/tools/csv-whitespace-normalizer/?input=name%2Ccity%2Csku%0A%20%20Ada%20%20%20Lovelace%20%2C%20New%20%20%20York%20%2C%20%20AB%2012%20%20CD%20%0AGrace%20Hopper%2CBerlin%20%2CXY34&delimiter=comma&trim=both&internal=collapse&whitespace=unicode&columns=sku&header=true&normalize_header=true

Machine-readable descriptor: tool.json — title + parameters JSON Schema for agents.