←
Developer

HTML Formatter

Loading the tool…

Ready when you are.Runs in this browser · nothing is uploaded

Beautify or minify HTML

  • Free
  • No sign-up
  • No upload
  • Works offline

Tool facts

Opens
HTMLHTMXHTMLVUESVELTE
Saves as
HTML
Price
Free, no sign-up, no watermark
Are files uploaded?
No. Everything is processed in this browser, on your device.
Batch processing
One file at a time
Offline use
Works without a connection once this page has loaded
Built with
js-beautify
Browser
A recent Chrome, Edge, Firefox or Safari, on computer or phone.

Check it yourself: press F12, open the Network tab, then use the tool. No request carries your data.

About HTML Formatter

This HTML formatter turns minified or badly indented markup into readable HTML with one element per line and consistent indentation, and it can also do the opposite: minify HTML to make pages smaller. Beautify mode uses the widely used js-beautify engine, which also indents the CSS inside style tags and the JavaScript inside script tags, lets you choose 2 spaces, 4 spaces or tabs, and can wrap long lines and put each attribute on its own line.

Minify mode is deliberately safe. It collapses runs of spaces, tabs and line breaks into one space, tidies whitespace inside tags, optionally removes comments (keeping Internet Explorer conditional comments), and trims whitespace next to block-level elements such as div, p, li and table where browsers ignore it. Content inside pre, textarea, script and style is kept byte for byte, so preformatted text and code keep working. The status bar shows how much smaller the file became. Everything runs locally; nothing is uploaded.

HTML Formatter runs entirely in your browser. Your data is processed on your device and is never uploaded to Qiyi or anyone else.

How to use HTML Formatter

  1. Paste HTML into the Input box, or open or drop an .html file.
  2. Choose Beautify or Minify under Mode.
  3. For Beautify, set the Indentation, how to Wrap attributes and the Line length. For Minify, choose whether to Remove comments and Trim whitespace around block tags.
  4. Copy the result from the Output box or click Download to save the file.

Frequently asked questions

Will minifying change how my page looks?

Collapsing whitespace to a single space never changes rendering in normal text, because browsers already collapse it. Trimming whitespace next to block-level tags is also invisible in standard layouts. The one case to check is elements you styled as inline-block or with white-space: pre via CSS; if spacing changes there, turn off Trim whitespace around block tags.

Why is the content of pre, script and style not changed?

Whitespace is meaningful inside pre and textarea, and changing JavaScript or CSS needs a real parser to stay correct. The minifier leaves those blocks untouched. To shrink inline code as well, use a dedicated CSS or JavaScript minifier.

Does the formatter fix broken HTML?

No. It re-indents the markup as written and does not add missing closing tags or validate the document. Unclosed tags can make the indentation drift, which is often a useful hint about where the error is.

How much smaller does minified HTML get?

Typically 5–20% for hand-written pages, more if they are heavily indented or commented. If your server already uses gzip or Brotli compression, the transfer saving is smaller, because whitespace compresses well.

Is my HTML uploaded?

No. Both beautifying and minifying run in your browser, so templates, internal pages and emails stay on your device.

· Free · Runs in this browser · nothing is uploaded

Drop any file here
Drop it to see which tools can open it