Paste HTML, format it for readability, or minify it for production without uploading your code. You can also open a local file, inspect parsing feedback, and preview the result safely.
Engines, safety limits, and testing
Processing engines: minification uses html-minifier-terser 7.2.0; formatting uses js-beautify 2.0.3; feedback uses HTMLHint 1.9.2; and the enhanced editor uses CodeMirror 5.65.21. These pinned libraries download from jsDelivr or cdnjs, then transformations run locally.
Important limits: whitespace can be meaningful around inline elements. Minification is not validation. Beautification cannot reconstruct removed comments or original formatting. Malformed markup may be rejected or produce unexpected output. Retest email templates, framework syntax, and any production-critical result.
script and style: contents are preserved unless embedded formatting or minification is enabled.
pre and textarea: preformatted contents are preserved by the processing engines.
code: the formatter keeps its content unformatted, but a standalone code element still follows normal HTML whitespace rules during minification; wrap whitespace-sensitive code in pre.
- SVG: parsed as markup with case-sensitive names preserved; Maximum options may still optimize legal attribute syntax.
- Conditional comments: kept while Protect conditional comments is enabled; disabling it can remove them with other comments.
- Template fragments: common
{{...}}, {%...%}, <%...%>, and [[...]] fragments are protected during minification. Framework-specific syntax can differ and must be tested.
The preview has an empty iframe sandbox and an injected Content Security Policy. It disables scripts, forms, navigation, frames, and external network resources; only inline styles and data/blob media are allowed. It is a visual aid, not a security scanner or full browser-equivalence test.
HTML formatter and minifier FAQ
What is the difference between an HTML formatter, beautifier, and minifier?
Formatter and beautifier usually mean the same thing: they add consistent indentation and line breaks for people to read. A minifier removes safe-to-remove bytes for delivery. Formatting generally increases size; minification generally reduces it.
Does the tool process inline CSS and JavaScript?
Only when you enable the embedded CSS and JavaScript option for the selected mode. Leave it off to keep script and style contents unchanged as far as that engine permits. Always test generated code.
Is HTML minification reversible?
No. A formatter can make minified markup readable, but it cannot reconstruct removed comments, optional tags, attribute quotes, or the author's original spacing and line breaks. Keep the source file in version control.
Can removing whitespace break a page?
Yes. Whitespace can be meaningful between inline elements, in preformatted content, in templates, and in some email layouts. Conservative mode reduces risk but does not remove the need to test the output.
What happens with malformed HTML?
HTMLHint reports likely problems with line and column locations, and the processing engines may reject or reinterpret malformed input. The tool does not claim to repair markup automatically.
Does it support HTML5, SVG, and template syntax?
The engines handle common HTML5 and inline SVG markup. Common Mustache, Liquid, ERB, and double-bracket template fragments are protected during minification, but framework syntax varies and must be retested. SVG case is preserved.
What is the maximum practical file size?
There is no upload limit because processing is local. Performance depends on the device and browser; files above 2 MB trigger a warning, and about 5 MB is a sensible practical ceiling for this interactive page.
Which indentation choices are available?
Formatting supports tabs or one to eight spaces per indentation level, optional line wrapping, and a configurable maximum line length from 40 to 500 characters.
Is my HTML private?
Transformations run in the browser and this page does not transmit editor contents. Pinned processing and editor libraries are downloaded from jsDelivr and cdnjs, so those providers can receive ordinary page-resource request data, but not the HTML in the editor.
Does the tool save my HTML locally?
Autosave is on by default and stores input in this browser's localStorage. You can turn autosave off or select Clear saved input. Output is not autosaved.
Is it safe for HTML email templates?
Use Conservative mode and test every output in the email clients you support. Email layouts often depend on whitespace, conditional comments, table structure, and unusual attributes, so Maximum mode is not recommended without a full rendering test.
Does validation guarantee valid HTML?
No. Parsing feedback is a useful lint check, not a standards-conformance guarantee, and minification is not validation. Use a dedicated validator and test the rendered result for production-critical markup.