Format CSS, SCSS or Less with syntax-aware indentation and line wrapping.
HTML Formatter
Format and beautify HTML fragments or full documents with HTML-specific controls.
Runs in your browserProcessed locally. Your input never leaves your device.
Details
About this tool
Paste an HTML fragment or complete document and get clear, consistent nesting. Set indentation and line length, decide how whitespace-sensitive elements are treated, and optionally place each attribute on a separate line.
The HTML parser understands tags, attributes, embedded style blocks and script blocks. This is safer than a generic code indenter, especially around inline content where whitespace can affect the rendered result.
The document is formatted locally in your browser and is never uploaded.
Keep going
Related tools
- Runs in your browserDeveloper
-
Format and beautify JavaScript with configurable indentation, quotes and semicolons.
Runs in your browserDeveloper -
Format, indent or minify XML without uploading it.
Runs in your browserDeveloper
Good to know
Questions people actually ask
- Is this a real HTML parser?
- Yes. The tool uses Prettier's HTML parser, not regular expressions or a generic indentation algorithm.
- Is the source code uploaded?
- No. Parsing and formatting run in the browser. The language engine is loaded on demand and the source stays on the device.
- Can formatting change program behaviour?
- The formatter is designed to preserve the parsed program while normalising attributes and whitespace handling. Review a diff before committing, especially when a repository enforces different style rules.