Indent messy HTML, or minify it and see the bytes you saved
Runs in your browser. Nothing you type is sent anywhere. Updated on 24 Oct 2026.Formatting HTML indents nested tags so the structure becomes visible, and minifying removes the whitespace between them. The bytes saved are shown, which on a 100 KB page is usually worth having. Everything is parsed in your browser, so an unreleased page stays private.
Paste the markup into the HTML box, or press Try an example.
Leave Format selected to indent it, or pick Minify to strip comments and spare whitespace.
In Format, choose 2 spaces, 4 spaces or Tab, and set Wrap at for long attribute lists.
Press Copy or Download to take the result.
This HTML formatter does the two jobs people need from markup: make it readable, or make it small. Paste on the left and the result appears on the right. Format indents every element on its own line at two spaces, four spaces or a tab, and wraps long attribute lists at the width you choose. Minify strips comments and spare whitespace and shows the size before, the size after and the percentage saved.
Most visits start with markup nobody wrote by hand. A page saved from a browser arrives as one line. A template engine produces a block with tabs and spaces mixed. A build step hands you production HTML and you need to find how a section is put together. Formatting first turns any of those into something you can read and search.
The minifier is deliberately careful. A space between two inline elements is visible on screen, so it stays; only whitespace between block-level tags, which the browser throws away anyway, is removed. Comments go except conditional comments for old Internet Explorer. The contents of pre, textarea, script and style are copied character for character, so indentation your users can see is never touched. Removing attribute quotes leaves any value containing a slash quoted, because browsers accept href=/a/b but several build tools will not read it. Scripts and stylesheets are not minified here; use the JavaScript Minifier and the CSS Minifier for those.
If the markup cannot be read, you get the line and column of the problem and what to fix, such as a comment that never closes or an attribute value missing its quote. Everything runs in your browser, so pages containing customer names or internal URLs never leave your device.
Yes. There is no signup, no watermark and no limit on how much markup you paste or how often you use it. The page is paid for by a few ads shown outside the tool, never inside your result.
No. Formatting and minifying run in your browser with JavaScript. Markup containing customer names, internal URLs or API keys in a script tag never leaves your device, and nothing is stored after you close the tab.
Usually 3 to 10 percent of the raw bytes, and a little more with attribute quotes removed. Deeply indented markup saves most; a page that is already minified saves nothing. The tool shows the exact size before, the size after and the percentage, so you never have to guess.
Minifying should not change how a page renders. Whitespace is only removed between block-level tags, where browsers ignore it anyway. A space between two inline elements such as span or strong is visible, so it is kept, and the contents of pre, textarea, script and style are copied exactly.
Yes. Choose Format and the single line is expanded into indented markup, one element per line. Nothing is added or removed, so you are reading exactly what the browser received. Pick the indent width and the wrap width that match your editor.
No. Anything inside a style or script tag is copied unchanged, because minifying it needs a real CSS or JavaScript parser. Run those through the CSS Minifier and the JavaScript Minifier and paste the results back.
Still stuck? Ask about HTML Formatter & Minifier and anybody who knows can answer. No account needed.
Same job, other tools: JavaScript Beautifier – Reformat JavaScript with Prettier, in the indent style you use · JSON Minifier – Strip whitespace from JSON for production · CSS Minifier – Compress a stylesheet and see exactly how many bytes you saved · JS Minifier – Shrink a JavaScript file with terser and see the size saved · Markdown to HTML – Convert Markdown into clean, safe HTML you can paste anywhere.
On the related tools: GraphQL Validator – Check a GraphQL query or schema for errors, optionally against your own SDL.
Also works as: HTML Beautifier.
In the collection Code Formatters and Minifiers.