Format and beautify HTML from View Source or a build into indented markup, inline CSS and JavaScript too, errors by line
Turn a page’s one-line source into HTML you can read, one element per line, with the styles and scripts inside it formatted as well.
How to use it
Paste HTML on the left, or open an .html file. Pick CSS, JavaScript or GraphQL above it for those. Choose the indent and the line width long lines wrap at (20 to 320). Under Options, choose how whitespace between inline tags counts, one attribute a line, and the closing > on the last attribute’s line. Copy or download the result. A tag closed in the wrong place is named with its line and column, marked in your text.
Examples
A navigation list from View Source
<ul class="nav"><li><a href="/">Home</a></li><li><a href="/docs">Docs</a></li></ul><p>Read the <b>docs</b> first.</p>
<ul class="nav"> <li><a href="/">Home</a></li> <li><a href="/docs">Docs</a></li> </ul> <p>Read the <b>docs</b> first.</p>
Short elements stay on one line; <b> stays inside the sentence, since a line break there would add a space.
Inline style and script formatted too
<style>.note{color:#555;margin:0}</style><script>if(user){greet(user.name)}</script><style>
.note {
color: #555;
margin: 0;
}
</style>
<script>
if (user) {
greet(user.name);
}
</script>A tag closed in the wrong place
<div class="card"><span>Total</div>
Line 1, column 30Unexpected closing tag "div"
The <span> is still open where </div> comes.
What formatting changes, and what it keeps
Big pages
Questions
- Does it fix broken HTML?
No. A tag closed in the wrong place stops formatting, with its line and column, so nothing is silently moved. Tags HTML lets you leave open, like <li> and <p>, are fine: their end tags are written in. - Can it format a Vue, Svelte or Angular template?
It reads them as HTML, so attributes like v-if, @click and (click) and text like {{ user.name }} stay as written while the tags around them are laid out. - Is my HTML uploaded?
No. Everything runs in your browser, so your HTML stays on your device. Nothing you paste is uploaded unless you share a result, which is locked with your password first. Saved pages can hold tokens in forms or scripts, and the page warns you if it spots a key.