HTML Prettifier
Re-indent and clean up minified or messy HTML — preserves <pre>, <script> and <style> exactly.
Quick answer: Re-indent and clean up minified or messy HTML — preserves <pre>, <script> and <style> exactly.
Last updated
Frequently asked questions
- Is this the same as our HTML Minifier in reverse?
- Roughly — minify removes whitespace; prettify adds it back. They're not lossless inverses (minify drops comments, prettify can't recover them), but the formatted output is semantically equivalent to your input.
- Will it break my JavaScript or CSS?
- No — <code><script></code> and <code><style></code> blocks are passed through untouched. Their contents are not re-indented.
- Why are inline elements kept on the parent's line?
- For readability — <code><p>Hello <b>world</b>.</p></code> is much clearer on one line than across five. The prettifier only inlines a parent that has exactly one text child wrapped in inline tags.
- Can I change the indent size?
- Yes — drag the slider from 0 to 8 spaces. The default is 2, matching the prevalent web convention.
- Does it validate the HTML?
- No — formatting is structural only. Pass the result through the W3C HTML Validator if you need spec compliance.
- Will it preserve attribute quoting style?
- Yes — single-quoted, double-quoted and unquoted attribute values all pass through unchanged.
- Will my comments be preserved?
- Yes — comments are kept and indented like other block-level content.
- Are my files uploaded?
- No — every transformation runs in your browser. Nothing leaves your device.
- How big a file can I prettify?
- Files up to a few megabytes prettify in well under a second. Beyond that, performance depends mostly on browser memory.
- Why is the output sometimes wider than expected?
- We don't wrap long lines — only re-indent. If you need 80-column wrapping, run the output through a desktop formatter like Prettier afterwards.