JSON 格式化
以两个空格缩进排版 JSON,压缩为单行并检查语法。
空白の意味を壊さずにHTMLを整形・圧縮。
Because whitespace in HTML can be meaningful, this tool avoids DOMParser and uses a dedicated tag-aware tokenizer instead. <pre> and <textarea> contents are kept byte-for-byte, and <script>/<style> contents are never re-parsed as HTML. Paragraphs containing inline elements (<a>, <span>, etc.) stay on one line to avoid introducing unintended spacing. Everything runs entirely in your browser; nothing is sent externally.
It avoids DOMParser and uses a dedicated tokenizer that correctly understands attribute values and the contents of script/style. Unlike DOMParser, it won't silently insert html/head/body or drop invalid markup — it just re-indents the document you actually wrote.
Yes. In both format and minify mode, the contents of <pre> and <textarea> are never changed by even a single byte, since that whitespace can affect what's displayed or used as an initial value.
No. Content made up entirely of inline elements is kept on a single line, because inserting a newline next to an inline element would introduce an unintended visible gap.
No. Adding omitted closing tags, stripping attribute quotes, or reordering/deduplicating attributes would rewrite the structure you wrote, so these optimisations are intentionally left out in favour of never breaking your markup.
No. Formatting and minification run entirely in your browser's JavaScript; nothing is sent to toco.tools's servers or anywhere else.