HTML Formatter & Beautifier
Format, beautify, or minify valid and broken HTML without uploading your code.
HTML formatter workspace
Formatting settings
Preview is available for output up to 2,000,000 characters. Copy or download larger results.
Online HTML formatter and HTML beautifier
Paste an HTML document, component, email template, generated snippet, or minified response and choose Format HTML to prettify the markup. Use it to format HTML online: consistent indentation and line breaks beautify HTML code and turn a minified response into pretty HTML that is easier to review. Choose Minify when you need a compact copy while keeping raw content inside pre, textarea, script, and style elements intact.
How to format or pretty-print HTML
- Paste valid, minified, incomplete, or malformed HTML into the input pane.
- Choose indentation, wrapping, and newline settings, then select Format HTML.
- Review any advisory, then copy, download, or preview the result in the HTML Viewer.
A formatter that still works with broken HTML
Incomplete work is common while editing: a closing tag may be missing, nesting may be mismatched, or an attribute quote may be unfinished. This HTML code formatter uses a tolerant tokenizer to reformat HTML code and return best-effort output instead of blocking on the first syntax problem. Advisory warnings tell you when the source appears malformed, but the original structure is not silently reparsed through the browser.
HTML formatting is not HTML validation
A formatter changes whitespace and indentation. A validator checks conformance to HTML rules, while a browser parser may also infer missing elements and repair a document tree. This formatter does not promise either result: review warnings and test the output in an HTML viewer or browser before using it in production.
Preview formatted HTML safely in the HTML Viewer.
Private, local HTML processing
Your input and formatted output stay in this browser tab. Formatting, minification, copying, and download preparation run locally with no account or upload required.
When an HTML formatter is not enough
Use this formatter to prettify HTML for a snippet, generated response, or quick cleanup. Move to Phoenix Code when the work spans HTML, CSS, JavaScript, assets, and multiple files, or when you need Live Preview, project-wide search, Git, and code intelligence in one editor.
Frequently asked questions
Can this formatter beautify invalid or malformed HTML?
Yes, in best-effort mode. It can indent many snippets with missing closing tags, mismatched nesting, or optional end tags. Unsafe unfinished tokens are preserved verbatim with an advisory so formatting does not silently reinterpret them.
Will formatting fix broken HTML?
No. Formatting makes source easier to read, but it does not guarantee repaired syntax or semantics. The tool avoids silently replacing your source with a browser-reconstructed document, so you can see and correct the original markup yourself.
Does minifying HTML change script, style, pre, or textarea content?
The minifier protects those raw-content regions and only removes conservative formatting whitespace around the rest of the markup. Always test behavior-sensitive templates before deployment.
Is my HTML uploaded?
No. The formatter and minifier run locally in your browser, and downloads are created on your device.
Take formatted HTML into a full code editor
Phoenix Code is the next step for project-level HTML, CSS, and JavaScript work with Live Preview, project search, Git, and code intelligence.