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.
The input looks unbalanced — check unclosed tags or braces.
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
JSON Formatter
Format, minify, repair and validate JSON data.
Open ToolSQL Formatter
Format and minify SQL queries locally with common database dialects.
Open ToolMarkdown Editor
Write, edit, and preview Markdown with live rendering, tables, task lists, math, diagrams, and highlighted code blocks.
Open Tool