Home β€Ί Tools

Line ending and whitespace inspector

Open a file or paste text to see its line endings, indentation, BOM and any invisible characters, then normalize it with one click.

πŸ”’ Runs entirely in your browser. Nothing you paste is uploaded or sent to a server.


Normalize

Why invisible characters break things

Problem Typical error Fix
CRLF line endings in a shell script /bin/bash^M: bad interpreter, exec user process caused: no such file or directory in Docker Convert to LF (bad interpreter)
Mixed CRLF / LF Git warning LF will be replaced by CRLF, noisy diffs Pick one and set .gitattributes (LF will be replaced by CRLF)
Tabs and spaces mixed Python TabError: inconsistent use of tabs and spaces, YAML "found character that cannot start any token" Convert tabs to spaces (TabError)
UTF-8 BOM Unexpected token in JSON, #! line ignored, PHP "headers already sent" Remove the BOM
Non-breaking space (U+00A0) SyntaxError: invalid non-printable character, "command not found" for a pasted command Replace with a normal space
Zero-width space (U+200B) A variable or key that "exists" but is never found Remove it
Smart quotes β€œ ” Syntax errors in code copied from documents or chat Straighten them

Pasting vs opening a file

Browsers convert every pasted line break to LF, so the line-ending count is only reliable when you open the file with the button above. Opening a file also reports its encoding (UTF-8, UTF-8 with BOM, UTF-16, or not valid UTF-8). The file is read locally and never uploaded; Download result saves the normalized version with the original name.

Doing it from the command line

file script.sh                      # "with CRLF line terminators"
cat -A script.sh | head             # ^M$ = CRLF, ^I = tab, M-BM-  = NBSP
sed -i 's/\r$//' script.sh          # CRLF -> LF (or: dos2unix script.sh)
sed -i 's/[ \t]*$//' file           # strip trailing whitespace
sed -i '1s/^\xEF\xBB\xBF//' file    # remove a UTF-8 BOM
expand -t 4 in.py > out.py          # tabs -> 4 spaces
grep -nP '[\x{00A0}\x{200B}]' file  # find NBSP and zero-width spaces

To stop the problem coming back, add * text=auto eol=lf to .gitattributes and an .editorconfig with end_of_line = lf and indent_style = space.

Last updated 2026-11-05.