Whitespace VisualizerFind Hidden Spaces and NBSP

Paste text or code to see every space, tab, and hidden character as a visible symbol. Trailing whitespace and invisible characters are highlighted, and you can clean them up in one click.

Your input is never sent anywhere.

Details
0
Spaces
0
Tabs
0
No-break
0
Zero-width
0
Other
0
Lines
Tab width
Input text
Preview with symbols
The preview appears here
·Space
⇥Tab
⍽No-break space
∅Zero-width
␣Other Unicode space
□Ideographic space

How to read the colors

Leading whitespace is blue, trailing whitespace has a rose background, hidden characters are red, and an ideographic space inside a line is amber. Hover over a symbol to see its code point. The symbols exist only in the preview. Copy text gives you the actual characters.

How to find hidden spaces and invisible characters in text

Some characters in your text can't be seen: a trailing space, a tab, a no-break space that looks like a normal one, or a zero-width space that has no width at all. They cause errors that are hard to track down because the text looks right.

This tool replaces each of them with a symbol and a color in a preview next to your text. A line with trailing whitespace gets a rose background, and hidden characters show in red. Hover over a symbol to see its name and code point.

Counts at the top show how many of each kind you have, and Lines to check narrows the preview to the lines that need attention. Then clean up in one click, and use Undo if you don't like the result.

Where invisible whitespace causes trouble

Code pasted from a web page or chat

A snippet copied from a page can carry no-break spaces. Python reports them as an invalid non-printable character, and other languages give similar errors.

Spreadsheet data from the web

A lookup that should match and doesn't is often a no-break space or a trailing space in one of the cells. Paste the values here to see which.

IDs, names, and CSV headers

A zero-width space or a byte order mark can sit inside an ID or at the start of a file and make two identical-looking values different.

Copy that goes into a CMS or a repository

Trailing spaces and mixed tabs and spaces clutter diffs and can change how Markdown breaks lines. Check before you publish or commit.

How to check and clean whitespace in 4 steps

  1. Paste your text or code into the Input text box, or click Try an example.
  2. Read the counts and the warning at the top. Hidden characters and ideographic spaces inside a line trigger a warning.
  3. Check the preview. Click Lines to check to show only the lines that need attention, and use the line numbers to find them in your editor.
  4. Click a cleanup button such as Fix hidden characters or Trim trailing, then click Copy text.

Note: The symbols exist only in the preview. Copy text gives you the real characters, without symbols.

What gets flagged and what doesn't

  • Colors: leading whitespace is blue, trailing whitespace has a rose background, hidden characters are red, and an ideographic space inside a line is amber.
  • Fix hidden characters replaces no-break spaces and other Unicode spaces with a regular space, and deletes zero-width characters.
  • Zero-width joiner and non-joiner (U+200D, U+200C) are not flagged, since emoji and some writing systems depend on them. If you need them removed, delete them in your editor.
  • Trim leading and Trim trailing also remove hidden characters at the start or end of a line, not just spaces and tabs.
  • Line breaks aren't part of the check. The text box stores line breaks in one form, so Windows and Unix line endings can't be told apart here.

Whitespace and invisible characters by code point

The characters the tool shows, the symbol used for each, and what tends to go wrong.

CharacterCode pointSymbolCommon problem
SpaceU+0020·Double spaces, trailing spaces
TabU+0009⇥Mixed with spaces; YAML does not allow tabs for indentation
No-break spaceU+00A0⍽ (red)Looks like a space but doesn't match one; Excel TRIM leaves it in
Figure space, narrow no-break spaceU+2007, U+202F⍽ (red)Same problem as the no-break space
Other Unicode spaces (en, em, thin, hair)U+2000 to U+200A, U+205F␣ (red)Different widths; fail exact matches
Zero-width spaceU+200B∅ (red)No width at all; breaks comparisons and IDs
Byte order markU+FEFF∅ (red)At the start of a file; can corrupt the first CSV header
Word joiner, soft hyphen, direction marksU+2060, U+00AD, U+200E, U+200F∅ (red)Invisible; surprise mismatches
Ideographic spaceU+3000□ (amber inside a line)As wide as a CJK character; can cause code errors

Why text that looks identical doesn't match: a regular space is U+0020 and a no-break space is U+00A0. They look the same on screen, but programs compare code points, not appearance.

Hover over any symbol in the preview to see its name and code point.

Why identical-looking text doesn't match

The usual causes behind lookups, comparisons, and code that fail for no visible reason.

No-break spaces in Excel and Google Sheets

Text copied from a web page often contains no-break spaces, character code 160. Excel's TRIM removes only the standard space (code 32), so these stay, and a lookup against the same text can fail.
In Excel you can convert them first with =TRIM(SUBSTITUTE(A1,CHAR(160)," ")). For a block of text or a pasted column, Fix hidden characters here does the same job in one click.

Invalid non-printable character errors in code

When code copied from a web page or a chat contains a no-break space, Python stops with SyntaxError: invalid non-printable character U+00A0, and other languages report something similar.
Paste the code here and the offending character shows up red on its line, with the line number. Fix hidden characters swaps it for a regular space.

Trailing whitespace, tabs, and the diff

Trailing spaces and mixed tabs and spaces add noise to a code review. Git can flag trailing whitespace with git diff --check, and Python raises a TabError when tabs and spaces are mixed inconsistently in indentation.
In Markdown, two spaces at the end of a line create a line break, so check before you trim text that relies on it.

Whitespace bugs and how to fix them

A lookup fails on two cells that look the same

A product name from a web page has a no-break space where your list has a regular one. The values look identical, but the lookup returns no match, and TRIM doesn't help because it only handles the standard space.

💡 See the solution▼
Paste the column here and look for red ⍽ symbols. Click Fix hidden characters, copy the result back, and run the lookup again. In Excel you can also use TRIM(SUBSTITUTE(A1,CHAR(160)," ")).

Pasted code stops with a non-printable character error

A snippet from a tutorial or chat works on the page but fails in your editor with an invalid non-printable character error. The cause is a no-break space or a zero-width character in the pasted text.

💡 See the solution▼
Paste the snippet here. The line with the problem is marked in red, and Lines to check shows only the affected lines. Click Fix hidden characters and copy the code back.

Trailing spaces clutter a commit or break a layout

Spaces at the end of lines show up as changes in a diff, and in some formats they change how lines break.

💡 See the solution▼
Click Trim trailing to remove them from every line. If the text is Markdown, check first whether any line uses two trailing spaces on purpose as a line break.

Tabs and spaces mixed in the same file

Indentation looks aligned in one editor and shifts in another. YAML does not allow tabs for indentation, and Python can raise a TabError when tabs and spaces are mixed.

💡 See the solution▼
Choose a tab width of 2 or 4, then click Tabs → spaces to convert every tab to spaces. Check the preview afterward to make sure the indentation still lines up.

An invisible character inside an ID or a file header

A zero-width space in a user ID, or a byte order mark at the start of a CSV file, makes the value differ from the one you typed even though nothing seems to be there.

💡 See the solution▼
Paste the value or the file's first lines here. Zero-width characters show as a red ∅. Fix hidden characters deletes them.

Whitespace checker FAQ

Q.How do I see spaces and hidden characters in text?

Q.

A. Paste the text into the Input text box. The preview replaces each space, tab, and hidden character with a symbol and a color, so a space shows as a dot and a tab as an arrow. Hover over a symbol to see its name and Unicode code point, such as U+00A0 for a no-break space.

Q.How do I find trailing whitespace?

Q.

A. Trailing whitespace is shown with a rose background at the end of a line. The Lines to check button shows only the lines that end in whitespace, contain hidden characters, or have an ideographic space inside the line, each with its line number. Click Trim trailing to remove it from every line.

Q.What is a non-breaking space, and why does it cause problems?

Q.

A. A non-breaking space (U+00A0) looks like a normal space but is a different character, so a search for a regular space doesn't find it and a string that contains one doesn't match the same text with a regular space. It is common in text copied from web pages and word processors. In Excel, TRIM removes only the standard space, so a cell with a no-break space can still fail in a lookup.

Q.How do I remove non-breaking spaces and zero-width characters?

Q.

A. Click Fix hidden characters. Characters that take up width, such as the no-break space, are replaced with a regular space, and zero-width characters are deleted. Trim leading, Trim trailing, and Remove all whitespace also treat these characters as whitespace. Use Undo if the result isn't what you wanted.

Q.Which characters does the tool flag as hidden?

Q.

A. No-break spaces (U+00A0, U+2007, U+202F), other Unicode spaces such as the en space and thin space, and zero-width characters: the zero-width space (U+200B), word joiner (U+2060), byte order mark (U+FEFF), soft hyphen (U+00AD), and the left-to-right and right-to-left marks. The zero-width joiner and non-joiner are not flagged, because emoji and some writing systems need them.

Q.Do the symbols appear in the text I copy?

Q.

A. No. The dots, arrows, and boxes exist only in the preview. Copy text puts the actual characters, as currently edited, on your clipboard.

Q.What does Merge repeated spaces do to indentation?

Q.

A. It changes runs of two or more regular spaces inside a line into one space, and leaves the spaces and tabs at the start of each line alone, so code indentation stays the same. Tabs inside a line are not changed by this button.

Q.Is there a limit on how much text I can check?

Q.

A. The cleanup buttons have no line limit. To keep the page fast, the preview shows the first 800 lines, and a note appears when there are more. Every button still applies to all the text.

Q.Is my text sent to a server?

Q.

A. No. The text is analyzed with JavaScript in your browser, and nothing is uploaded. It stays in the page while it is open, and closing or reloading the page clears it.

User Feedback & Request

Your feedback
makes this tool better.

Tell us which features you'd like, what should be fixed, or which new tool you'd like to see. An engineer reads every submission and uses it to guide development.

Send feedback