All posts

How to Remove Spaces and Hidden Characters From Every Cell of a CSV

··3 min read

To remove spaces and hidden characters from a CSV, trim the start and end of every cell, collapse doubled spaces, and strip zero-width characters and non-breaking spaces. The CSV whitespace and hidden character cleaner does all three across every column in your browser and shows the cells that changed, before and after.

These characters cause quiet failures: an import rejects a row, or two copies of the same name will not match.

Why they matter

A space after an address can make an import reject the row, and the same name with and without a trailing space counts as two values. That breaks duplicate removal and matching against another list. Zero-width characters are worse because you cannot see them. They arrive by copy and paste from a website, a PDF or a chat window.

Step 1: do it by hand

In Excel or Google Sheets, put =TRIM(A2) in a new column, fill it down, then paste the values back over the original. TRIM removes spaces at the start and end and reduces runs of spaces inside to one. It only handles the ordinary space, character 32.

Two things it misses:

Character What it is Does TRIM remove it
Space (U+0020) Ordinary space Yes
Non-breaking space (U+00A0) Common from web pages No
Zero-width space (U+200B) Invisible No
Byte order mark (U+FEFF) Invisible, sometimes at the start of a file No

The usual workaround is a SUBSTITUTE for each character, one column at a time, which is tedious for a wide file.

Step 2: use the cleaner

  1. Upload the CSV or .xlsx, or paste the cells with the header row first.
  2. Leave the three options on, or switch off any you do not want.
  3. Read the rows that changed, shown before and after, and the columns they sit in.
  4. Download the cleaned list.

The three options are spaces at the ends of a cell, runs of spaces inside a cell, and hidden characters. Hidden characters covered are zero-width spaces and joiners, left-to-right and right-to-left marks, the soft hyphen and the byte order mark, and unusual spaces are turned into plain ones. The header row is cleaned too, so a column called Email becomes Email.

A side effect to know about

Turning runs of whitespace inside a cell into one space also turns line breaks inside a cell into a space. A multi-line cell, such as an address block, becomes one line. Switch the doubled-space option off if you need to keep them.

If the problem is the file, not the cells

If accented letters show as strange symbols, the problem is encoding, not spaces. See how to fix garbled characters in a CSV. If rows have the wrong number of columns, see how to fix broken CSV rows before an import. For a checklist of the steps in order, read clean your list before a campaign.

What this cannot do

  • It changes spaces and hidden characters only. It does not fix spelling, case or wrong data.
  • Only the first sheet of a workbook is read.
  • Clean cells can still be dead mailboxes. It does not check whether an address exists.

Check the addresses

Once the cells are clean, upload the list on the verify page: the first 100 email checks are free with a Google sign-in, no card. Each address comes back valid, risky or invalid with a reason, and nothing is sent to anyone on the list. For larger or recurring lists, see bulk email verification, list cleaning and pricing.

Clean your cells now

Upload the file to the CSV whitespace and hidden character cleaner.

Common questions

How do I remove leading and trailing spaces from a CSV?

In Excel or Sheets, use the TRIM function on each column and paste the values back. A cleaner tool trims every cell in the file at once.

Why does TRIM not remove all the spaces?

TRIM removes ordinary spaces only. A non-breaking space (character 160) or a zero-width space is a different character and stays.

What is a zero-width character?

A character that takes no room on screen, such as the zero-width space or joiner, but still counts as text. Two cells that look the same can differ by one.

Where do hidden characters come from?

Usually copy and paste from a web page, a PDF or a chat window.

Does cleaning change my data?

Only spaces and hidden characters. Letters, digits, punctuation and case stay as they are.

Check your list before you send

Real mailbox checks over SMTP, and nothing is sent to the address. Sign in with Google and your first 100 email checks are free, no card. Plans for bigger lists are on the pricing page.