How to use it
- Paste HTML into the left box.
- Choose Beautify for readable code or Minify for the smallest output.
- For Beautify, pick 2 spaces, 4 spaces or a tab, then copy the result.
How beautify lays things out
- Block elements (
div,p,ul,li,h1…, and unknown or custom elements) each start on a new line, indented one level deeper than their parent. - A block that holds only text and inline elements stays on one line when it fits in 100 characters; longer text is wrapped at the spaces that were already there.
- Attributes are separated by single spaces; their values and quotes are not changed.
- Void elements such as
br,imgandmetahave no closing tag.
Tips
Minifying inline <script> or <style> content is out of scope here: those blocks are copied unchanged. Use the JavaScript minifier on script contents first if you need that.