AI text tools

How to Remove Non-Breaking Spaces in Docs, Code and Spreadsheets

On this page
  1. Why non-breaking spaces cause trouble
  2. Excel
  3. Google Sheets
  4. Microsoft Word
  5. Google Docs
  6. Code editors
  7. Other spaces to watch for
  8. How to tell if a cell contains one
  9. Cleaning a whole column at once
  10. Other places they hide
  11. When to keep them
  12. Common mistakes
  13. Removing them in other tools
  14. Quick checklist

Quick answer: a non-breaking space looks like a normal space but is a different character (Unicode U+00A0, code 160). To remove it in Excel, use =SUBSTITUTE(A1, CHAR(160), " "). In Google Sheets, use =SUBSTITUTE(A1, CHAR(160), " "). In Word, find ^s and replace with a space. For any text, paste it into an invisible character remover.

Why non-breaking spaces cause trouble

A non-breaking space stops a line from breaking between two words, such as "10 km". That's useful in typesetting, but elsewhere it:

  • Makes numbers like "1 250" count as text in spreadsheets
  • Stops TRIM from cleaning cells in Excel
  • Makes find and replace miss matches
  • Causes errors in code and data files

Excel

Replace inside a cell with a formula:

=SUBSTITUTE(A1, CHAR(160), " ")

Wrap it in TRIM to clean up extra spaces too:

=TRIM(SUBSTITUTE(A1, CHAR(160), " "))

Replace across a whole sheet: open Find and Replace (Ctrl+H). Click in the "Find what" box, hold Alt and type 0160 on the number pad, then type a normal space in "Replace with" and choose Replace All.

If a number still won't calculate, convert it with =VALUE(...) after substituting.

Google Sheets

Use the same formula:

=SUBSTITUTE(A1, CHAR(160), " ")

Or open Edit → Find and replace, tick Search using regular expressions, search for \x{00A0} and replace with a space.

Microsoft Word

Open Replace (Ctrl+H), type ^s in "Find what" (Word's code for a non-breaking space), type a normal space in "Replace with", and choose Replace All.

Google Docs

Docs' find and replace doesn't make non-breaking spaces easy to target. The quickest route is to copy the text, clean it with the invisible character remover, and paste it back.

Code editors

In VS Code, open search with regular expressions enabled and search for \u00A0, replacing with a space. Many editors can also highlight unusual whitespace; in VS Code, the "Unicode highlight" settings do this.

In Python:

text = text.replace("\u00a0", " ")

In JavaScript:

text = text.replace(/\u00a0/g, " ");

Other spaces to watch for

Non-breaking spaces have relatives that cause the same problems: the narrow no-break space (U+202F), thin space (U+2009) and figure space (U+2007). The invisible character remover handles all of them at once and also removes zero-width characters, which formulas like the ones above miss.

How to tell if a cell contains one

In Excel or Google Sheets, these quick tests reveal a hidden non-breaking space:

  • =LEN(A1) returns more characters than you can see.
  • =CODE(MID(A1, 2, 1)) returns 160 for a non-breaking space in position 2 (a normal space returns 32).
  • A value that looks like a number is left-aligned and won't sum.

Cleaning a whole column at once

  1. Insert a helper column next to the data.
  2. Enter =TRIM(SUBSTITUTE(A1, CHAR(160), " ")) and fill down.
  3. Copy the helper column and Paste Special → Values over the original.
  4. Delete the helper column.
  5. If the values are numbers, select the column and convert them with Data → Text to Columns → Finish in Excel, or set Format → Number in Google Sheets.

Other places they hide

Copied web tables. Prices like "1 299" or "€ 25" often use a non-breaking space between the digits or the currency.

PDF text. Copying from PDFs often brings in odd spacing characters.

CSV exports from some systems use them as thousands separators in European number formats.

Word documents. Word inserts non-breaking spaces automatically in some languages, such as before a colon or question mark in French.

When to keep them

Non-breaking spaces are useful in finished documents: between a number and its unit ("10 km"), in names ("Mr. Lee"), and in dates, they stop awkward line breaks. Remove them from data and code, but consider keeping them in published text where line breaks matter.

Common mistakes

Relying on TRIM alone. TRIM doesn't remove character 160.

Replacing them with nothing. Deleting a non-breaking space joins the words on either side. Replace it with a normal space instead.

Missing related characters. The narrow no-break space (U+202F) and thin space (U+2009) cause the same problems and need their own replacement, or a tool that handles them all, such as the invisible character remover.

Removing them in other tools

Notepad++: open Replace, set Search Mode to Regular expression, find \x{00A0} and replace with a space.

Microsoft Word, the other way round: if you want to insert a non-breaking space, press Ctrl+Shift+Space. Knowing the shortcut helps you spot where they came from.

Command line (Linux or macOS): many text tools can replace the character in a file using its byte sequence; in UTF-8 a non-breaking space is the two bytes C2 A0.

Google Docs: clean the text externally and paste it back, since Docs' search can't easily target the character.

Quick checklist

  1. Test suspicious cells or text with LEN or CODE.
  2. Replace character 160 with a normal space.
  3. Run TRIM to remove extra spaces.
  4. Convert text back to numbers if needed.
  5. Check for related characters like U+202F.

Questions people ask

How do I remove non-breaking spaces in Excel?

Use =SUBSTITUTE(A1, CHAR(160), " "), or Find and Replace with Alt+0160 in the Find box and a normal space in the Replace box.

What is the code for a non-breaking space?

Unicode U+00A0, which is character 160. In Word’s find and replace, it is ^s.

Why doesn’t TRIM remove spaces in Excel?

TRIM only removes normal spaces (character 32). Non-breaking spaces (character 160) need SUBSTITUTE first.

How do I find non-breaking spaces in Excel?

Use =CODE(MID(A1, n, 1)) on a suspicious position; it returns 160 for a non-breaking space. =LEN(A1) longer than expected is another clue.

Should I replace a non-breaking space with nothing?

Usually no. Replace it with a normal space so the words on either side don’t run together.

What is the keyboard shortcut for a non-breaking space in Word?

Ctrl+Shift+Space in Word for Windows. On a Mac, Option+Space inserts one in most apps. Knowing this helps explain where they come from.

Why does my number have a space Excel won’t remove?

It is probably a non-breaking space, character 160. TRIM ignores it, so use SUBSTITUTE with CHAR(160) first.

Sources and further reading

Figures in this guide were calculated with our own calculators and checked against these sources.