Developer
HTML Formatter and Minifier
Format or minify HTML without changing what the page renders — inline whitespace is load-bearing and treated that way.
Runs entirely in your browser. Nothing you paste is uploaded.
0 characters · 0 bytes
This runs entirely in your browser. Nothing you paste is sent to us or to anyone else.
How to use it
- Paste your text into the box marked "Your HTML"Paste a page, a template or a fragment. Everything happens inside your browser — nothing is uploaded, so there is nothing for us to store, log or lose.
- Read the result as it updatesThere is no button to press. Choose Format to indent or Minify to compress, and the result updates immediately. The output recomputes every time you change the text or one of the options above it.
- Expect minification to be conservativeWhitespace between inline elements can be significant in HTML — it is a real space between words — so it is not removed everywhere a more aggressive minifier would. The output is safe to ship rather than merely small.
- Check what was left untouchedContent inside pre, textarea and script is preserved exactly, because reformatting it would change what it means. The notes say when that applied.
- Use the Indent control for your house styleTwo spaces, four spaces or a tab, applied as soon as you pick it.
- Copy or download the resultThe buttons under the output put it on your clipboard or save it as a file, and each one says exactly what it will copy or download. Any note about something the tool changed or deliberately left alone is shown with the result rather than hidden.
About this tool
Tidy HTML into indented structure, or strip it down for size — without changing what the page renders. That last clause is the whole tool: whitespace in HTML is visible, so a formatter that freely re-wraps markup quietly edits the page.
Concretely: a line break between two inline elements renders as a space, so <span>a</span><span>b</span> is never split, while a break next to a block element renders as nothing, so <div>s and <p>s are indented freely. Content of pre and textarea is whitespace-preserved verbatim, and embedded scripts and styles pass through byte for byte.
Understanding the result
Formatted output indents block structure and keeps runs of inline markup together on one line. Minified output removes only the whitespace that rendering ignores — next to block boxes — and keeps the single spaces between inline content, which are load-bearing.
Real-world HTML is accepted, not just textbook HTML: optional end tags (a new <li> closes the previous one), unquoted and bare attributes, uppercase tags, even embedded PHP tags, which are kept exactly as written.
The notes report every repair: an element that was still open when an outer closing tag arrived, a stray closing tag with no opener, duplicate attributes a browser would silently drop. Each of those usually marks a real mistake in the markup, which is why they are said aloud.
Example
Input
<div><ul><li>one<li>two</ul><p>See <b>this</b> note</p></div>Output
<div>
<ul>
<li>one</li>
<li>two</li>
</ul>
<p>See <b>this</b> note</p>
</div>Limitations
- Custom elements and anything else the tool does not recognise are treated as inline, because an unknown element could be styled display:inline — that is the guess that cannot change the page when it is wrong. The cost is that custom-element markup stays on one line.
- Embedded JavaScript and CSS are not reformatted — that is a rewrite of somebody else's code. Use the CSS formatter for stylesheets.
- This is a formatter with well-formedness repairs, not a full validator — it does not check attribute names, ARIA usage or nesting rules beyond the structural ones it repairs.
- A self-closing slash on a non-void element (<div/>) is honoured as written, although a browser would treat it as an opening tag. If your source contains that pattern, it is worth fixing at the source.
Questions
Is my HTML uploaded anywhere?
No. The whole tool is JavaScript running on your device — there is no request to send. You can confirm it by opening your browser's network tab, or by disconnecting from the internet and using the page anyway.
Why did my inline elements stay on one long line?
Because splitting them would change the page. A newline between inline elements collapses to a visible space; if the original had no space there, the formatter must not introduce one. Where a space already exists, or where block elements are involved, the formatter does break the line.
Why is minified HTML not much smaller?
Safe HTML minification is mostly whitespace removal, and pages that are already dense have little to remove. The large wins claimed by aggressive minifiers come from removing quotes and optional tags — transformations with edge cases this tool deliberately avoids. Tick "remove comments" for the other common win.
Can it fix broken HTML?
It repairs structure the way a browser does — closing unclosed elements, ignoring stray end tags — and tells you about each repair in the notes. What it repairs is well-formedness, not meaning: it cannot know which element you intended to close where.
Last updated 2026-08-16.
Related tools
- CSS Formatter and Minifier
Format or losslessly minify CSS — whitespace and comments only, values byte-for-byte untouched.
- HTML Entity Escape and Unescape
Escape markup so it displays as text, or decode entities back - without ever rendering them.
- XML Formatter and Validator
Format, minify and check XML for well-formedness, with every error located in your text.