Format the code.
See the structure.
Pretty-print HTML, CSS, or JavaScript locally with consistent indentation. Keep or remove comments, copy the result, or download a clean text file.
How do I format HTML online? Paste messy HTML, CSS, or JavaScript and get consistently indented output, processed locally.
HTML CSS JavaScript formatter
HTML and CSS use a structure-aware lightweight formatter. JavaScript uses a best-effort browser-safe formatter; review code in your normal test and lint workflow before committing. No input is uploaded.
How to format HTML, CSS, or JavaScript
- Paste your code — pick the language and indentation width.
- Format — comments and structure are preserved.
- Copy or download — readable markup for review and editing.
When you inherit unreadable code
- Minified or single-line HTML from an export or CMS
- Email templates that arrived as one wall of markup
- Before editing, so diffs make sense afterwards
Good to know
Formatting changes whitespace only. For HTML that is nearly always safe — with one edge case: whitespace between inline elements can add visible gaps, so for pixel-perfect layouts compare the rendering before and after. Related: minify for the return trip.
Does formatting change the code?
It changes whitespace and indentation for readability. It does not intentionally rename tags, properties, variables, or values. Treat the JavaScript mode as best effort and run your own tests.
Can comments be removed?
Yes. Clear “Keep comments” and format again. This is useful for inspecting a compact copy, while the existing Minify tool is the better fit for production byte reduction.
Does my code leave this page?
No. Formatting runs in the browser tab. There is no upload request, account, or remote formatter dependency.