Code Formatters
HTML Formatter
Format messy or minified HTML into readable, consistently indented markup. Embedded <style> and <script> blocks are formatted too, using the same parser (Prettier) that powers the CSS and JavaScript formatters.
Advertisement
Advertisement
Related tools
Features
- Formats embedded <style> and <script> blocks, not just the surrounding markup
- 2, 4-space, or tab indentation
- Preserves comments and structure — never changes what the page renders
- Copy or download the formatted result
How to use
- Paste minified or messy HTML into the input.
- Pick an indentation size and click Format.
- Copy the result or download it as a file.
Example
Input
<div><p>hi</p><span>x</span></div>
Output
<div> <p>hi</p> <span>x</span> </div>
FAQ
- Does this format the CSS and JavaScript inside my HTML too?
- Yes — content inside <style> and <script> tags is formatted with the same parser used by the CSS and JavaScript formatters, not left as-is.
- Is my HTML sent to a server?
- No. Formatting runs entirely in your browser using Prettier's standalone build — nothing is uploaded.
Advertisement