← All tools

HTML & CSS Formatter

Format or minify HTML and CSS locally with safe, lightweight parsing.

This tool runs entirely in your browser. Your input is never uploaded.

Source
Output

What is this tool?

Keep HTML and CSS readable or shrink them for embedding. Paste code, choose HTML or CSS, then format (pretty-print with indentation) or minify (one compact line, comments removed).

How it works

  • HTML is parsed with a lightweight tag scanner: it indents nested elements, keeps void elements like <img> and <br> on one line, preserves <pre>/<script>/<style> content, and drops comments when minifying.
  • CSS is tokenized to protect comments and strings: it pretty-prints selectors and declarations with indentation, and minifies by removing comments and unnecessary whitespace while keeping string values intact (including braces inside strings).

Limits

This is a light formatter, not a full validator. Unbalanced tags or braces are reported; very exotic or malformed HTML/CSS may need manual review.

Privacy

All parsing runs in your browser.

Related tools

A growing collection of browser-only tools. Your data stays on your device whenever the browser can handle the task.