Whitespace Visualizer
Reveal spaces, tabs, line endings, and non-breaking spaces in text
Whitespace Visualizer — what it does
Reveal the invisible characters in a text: spaces, tabs, line endings and non-breaking spaces, each marked so you can see exactly what is there. Most baffling text bugs — a lookup that will not match, indentation that will not align — turn out to be a character nobody could see.
Worked example
Three lines of form text copied from a document: a tab after "Name:", two trailing spaces, a non-breaking space before the amount and one trailing space on the second line. The output updates as you type.
Input — text (the tab and the non-breaking space are invisible here)
Name: Ann Lee Total: 1,250 Done
Output — with markers
Name:→···Ann·Lee··↵ Total:⍽1,250·↵ Done
· is a space, →··· a tab, ⍽ a non-breaking space and ↵ a line ending; the last line has no ↵ because the text does not end with a line break.
When this tool helps
- Finding out why two strings that look identical are not treated as equal.
- Diagnosing indentation that mixes tabs and spaces in a code or config file.
- Spotting non-breaking spaces pasted in from a word processor or a web page.
How to use it
- Paste the text into the input.
- Visualise the whitespace.
- Read the markers for spaces, tabs, line breaks and non-breaking spaces.
- Clean the text once you know what is in it.
Accuracy, limits, and good practice
- A non-breaking space looks exactly like a space and behaves like a different character everywhere — it is the usual culprit behind a failing comparison.
- Mixed tabs and spaces in indentation break Python outright and make every other language's formatting inconsistent.
- Trailing spaces at line ends are invisible in most editors and are a frequent cause of failed exact matches in data.
Frequently asked questions
What is a non-breaking space?
A space that prevents a line break at that point. It is a different character from an ordinary space and never matches one in a comparison.
Why does my lookup fail on identical-looking values?
Almost always a trailing space, a non-breaking space or a different line ending. Visualising the text shows which.
How do I remove what I find?
The text cleaner collapses spaces and removes empty lines; find and replace handles specific characters like non-breaking spaces.
Can it tell Windows (CRLF) from Unix (LF) line endings?
No. Both are shown as the same ↵ marker, so a file with mixed line endings looks uniform here. Use a text editor's line-ending indicator or a hex view for that check.
Which invisible characters are not marked?
Only the ordinary space, the tab, the non-breaking space (U+00A0) and line endings get markers. Zero-width spaces, the ideographic space (U+3000), thin or narrow no-break spaces and byte-order marks are shown as-is, which usually means as nothing at all. If a comparison still fails after this view looks clean, one of those is the likely cause — the Unicode Escape Converter will reveal them as \u escapes.
Related tools on this site
- Join Lines — Combine multiple lines using spaces, commas, or a custom separator
- Morse Code Converter — Encode text as Morse code or decode Morse back to text
- URL Query Parser & Builder — Inspect URL parameters or build a URL from key-value pairs
Further reading: Cleaning Up Text You Pasted From Somewhere Else
Everything above runs inside this page. Whitespace Visualizer needs no account, no upload, and no server round trip — close the tab and nothing is left behind.
空白字元視覺化能做什麼
把文字中的隱形字元顯示出來:空格、Tab、換行與不換行空格,各自標示,讓你清楚看到裡面到底有什麼。多數令人費解的文字問題——查表對不上、縮排永遠不齊——最後都是某個沒人看得見的字元在作怪。
實際範例
從文件複製的三行表單文字:「Name:」後面有一個 Tab、行尾兩個空格、金額前一個不換行空格、第二行行尾一個空格。文字會邊打邊更新。
來源:文字(Tab 與不換行空格在這裡看不見)
Name: Ann Lee Total: 1,250 Done
標記後
Name:→···Ann·Lee··↵ Total:⍽1,250·↵ Done
· 是空格,→··· 是 Tab,⍽ 是不換行空格,↵ 是行尾;最後一行沒有 ↵,因為文字不是以換行結尾。
什麼時候用得上
- 查明兩個看起來一模一樣的字串為什麼不相等。
- 診斷程式或設定檔中 Tab 與空格混用的縮排問題。
- 找出從文書軟體或網頁貼進來的不換行空格。
使用步驟
- 把文字貼進輸入區。
- 執行空白字元視覺化。
- 查看空格、Tab、換行與不換行空格的標示。
- 知道裡面有什麼之後,再清理文字。
精確度、限制與實務建議
- 不換行空格長得跟空格一模一樣,但在任何地方都是不同的字元——比對失敗的元兇通常就是它。
- 縮排混用 Tab 與空格會直接弄壞 Python,在其他語言中也會讓排版永遠不一致。
- 行尾的多餘空格在多數編輯器中看不見,是資料精確比對失敗的常見原因。
常見問題
什麼是不換行空格?
一種不允許在該處斷行的空格。它與一般空格是不同字元,比對時永遠不會相等。
看起來一樣的值為什麼查不到?
幾乎都是尾端空格、不換行空格或換行符不同。把文字視覺化就能看出是哪一種。
找到之後怎麼清掉?
文字清理工具可收攏空格、移除空行;不換行空格這類特定字元則用尋找取代處理。
分得清 Windows(CRLF)與 Unix(LF)換行嗎?
分不清。兩者都顯示成同一個 ↵ 標記,所以混合換行格式的檔案在這裡看起來是一致的。要核對這一點,請改看文字編輯器的換行格式指示或十六進位檢視。
哪些看不見的字元不會被標記?
只有一般空格、Tab、不換行空格(U+00A0)與行尾會有標記。零寬空格、全形空格(U+3000)、窄不換行空格與位元組順序標記都會原樣顯示,通常就是什麼都看不到。若這裡看起來乾淨但比對仍失敗,多半就是這些字元在作怪,Unicode 跳脫字元轉換器可以把它們顯示成 \u 跳脫序列。
本站相關工具
- 合併文字行 — 使用空格、逗號或自訂分隔符合併多行文字
- 摩斯密碼轉換器 — 將文字編碼為摩斯密碼或解碼回文字
- URL 查詢參數解析與建立 — 查看網址參數,或由鍵值資料建立完整網址
延伸閱讀: 清理從別處貼上的文字
以上步驟全部在這個頁面內完成,空白字元視覺化 不需要註冊、不上傳檔案、也不經過伺服器,關閉分頁後不會留下任何資料。