HTML Formatter
Indent an HTML document so it is readable, or minify whitespace. js-beautify runs in this tab. The markup is not rendered and not sanitized.
HTML
Limits
- The input is limited to 2 MB of UTF-8 text (8 MB if you load a file). Larger files can run out of memory in a phone browser tab.
- Not a sanitizer, HTML validator or accessibility checker.
- Malformed HTML may be auto-corrected in surprising ways or left messy.
- Huge pages, or pages with very large inline scripts, may be slow.
- Templating languages (Handlebars, Vue, Angular, PHP mixed in HTML) are not first-class and may wrap poorly.
Formatted HTML
How to use HTML Formatter
- Paste HTMLType, paste or load an .html file.
- Choose indent or minifySet the indent size, or minify ignorable whitespace.
- Copy or downloadCopy the result or download an .html file.
HTML, not a live preview
js-beautify’s HTML beautifier reprints tags with consistent indent and will also format <script> and <style> contents with its JS and CSS beautifiers. It tries to respect void tags and preserve the text inside preformatted elements, but it is not a full HTML5 parser.
The result is not executed, and it is not passed through a sanitizer. Do not treat formatting as a security fix.
Frequently asked questions
Is my text or file uploaded?
No. Everything runs in your browser tab with JavaScript. Nothing you type, paste or drop is sent to a server, logged or stored by ALink Tools.
Will this make unsafe HTML safe?
No. It only changes whitespace. Scripts, event handlers and unsafe URLs stay in the output.
Why did my template tags wrap strangely?
js-beautify expects HTML. Mustache, Vue and similar interpolations are not a supported syntax.
Is this the same as the XML formatter?
No. Use XML Formatter for well-formed XML. This page is aimed at HTML.
Related tools
All toolsXML Formatter
Pretty-print or minify XML in your browser, without sending it to a server.
CSS Formatter
Pretty-print or minify CSS in your browser with js-beautify.
JavaScript Formatter
Pretty-print or compact JavaScript in your browser with js-beautify.
HTML Encoder / Decoder
Escape and unescape HTML entities without running or rendering the markup.