Whitespace and Line Ending Fixer
See and fix invisible problems in text and code: mixed line endings, tabs versus spaces, trailing whitespace, byte-order marks and hidden Unicode characters.
ブラウザ内で動作します。ファイルは端末の外に出ません。 確認方法を見る
…
使い方
- 1Paste or open a file
Text or source code.
- 2Read the report
Line endings, indentation, invisible characters.
- 3Check the visible view
Markers show every hidden character.
- 4Choose the fixes
Line endings, tabs, trailing spaces and more.
- 5Compare before and after
The table shows what changed.
- 6Download
Save the cleaned file.
このツールについて
Some of the most confusing bugs come from characters you cannot see. A shell script edited on Windows fails with a bad interpreter error because every line ends in a carriage return. A YAML file breaks because one line is indented with a tab. A diff lights up because an editor stripped trailing spaces, a JSON parser rejects a file because of a byte-order mark, and a search fails because a copied phrase contains a no-break space or a zero-width joiner. Bidirectional control characters can even make source code display differently from how it runs. This tool makes all of it visible. It counts LF, CRLF and CR line endings, lines indented with tabs, spaces or both, trailing whitespace, BOMs and every kind of invisible or unusual space, shows the text with markers for each one, and cleans it in one pass with the options you choose. A before-and-after table proves what changed, and the download keeps the line endings you picked.
Line endings
Unix, Linux and macOS use LF. Windows uses CRLF. Classic Mac OS used CR alone. Git can convert automatically with core.autocrlf or a .gitattributes file such as text=auto with eol=lf for shell scripts. Mixed endings within one file are always a mistake and confuse many tools.
Tabs and spaces
Converting tabs to spaces respects tab stops, so a tab after two spaces moves to the next stop rather than adding a fixed number of spaces. Python forbids mixing tabs and spaces inconsistently, YAML forbids tabs for indentation, and Makefiles require tabs before commands, so do not convert Makefiles to spaces.
Invisible characters
- No-break space (U+00A0) and narrow no-break space: common in text copied from web pages and word processors. - Zero-width space, joiner and non-joiner: invisible but break search and comparisons. Note that zero-width joiners are needed inside some emoji and in scripts such as Persian and Hindi. - Byte-order mark: harmless for many editors, but breaks shebang lines, JSON parsers and CSV headers. - Bidirectional controls: needed for some right-to-left text, dangerous in source code.
Editor settings
Most editors show whitespace on request and can trim trailing spaces on save. An EditorConfig file in the repository lets every editor apply the same line ending, indentation and final newline rules automatically.
Limits
Cleaning is text-only and does not understand file formats, so it may change meaningful whitespace inside string literals or Markdown line breaks (two trailing spaces). Review the visible view before saving important files.
計算例
A pasted function with two CRLF and four LF line endings, one tab-indented line, a no-break space with a trailing space and a zero-width space becomes clean code with LF endings, four-space indentation, no trailing whitespace and exactly one final newline.
ポイント
- カテゴリ: 開発・データ
- ブラウザ内で動作し、登録もアップロードも不要です。
- 入力した情報は端末内にとどまります。
- 英語で利用できます。
- 内容の最終確認日:
- 公式情報源: Unicode Standard Annex 9 (bidirectional algorithm) and CVE-2021-42574
よくある質問
How do I convert CRLF to LF?
Choose LF in Line endings and download the cleaned text.
What is a BOM?
A byte-order mark, an invisible U+FEFF at the start of a file that some tools reject.
Why does my shell script say bad interpreter?
Usually CRLF line endings; convert the file to LF.
Are zero-width characters always bad?
No. They are part of some emoji and scripts. Remove them only from code and plain data.
What is the Trojan Source attack?
Hidden bidirectional characters that make code look different from how it runs.
Is my text uploaded?
No. Everything runs in your browser.
