Pro Every tool, icon and stickerAll of Pro for $5.99/month

  • All 85 tools
  • Festival Post Maker
  • Icon & sticker pack ZIPs
Go Pro
HubToolify
Text Tools

HTML Formatter Pro

Paste HTML to lay it out with clean indentation, or squeeze it down to the smallest safe size. Either way, the tool lists tags that were left open and closing tags that have nothing to close, with line numbers. Free preview · Pro required to export. Format or minify up to 3,000 characters of HTML free. Pro removes this limit and adds downloads.

Free preview · Pro required to export. Format or minify up to 3,000 characters of HTML free. Pro removes this limit and adds downloads.

Loading…

Why use this tool?

  • HTML copied from a CMS, an email or a minified bundle is often one long line. Indenting it makes the structure readable again.
  • A page that looks almost right usually has an unclosed tag somewhere. The problem list points to the line instead of silently repairing it.
  • Smaller markup means a smaller download, and the minifier reports exactly how much it saved.
  • Many formatters move whitespace and change how a page looks. This one keeps inline text together and leaves pre and textarea contents as they are.

How to use HTML Formatter

  1. Choose "Beautify" or "Minify" at the top of the left panel.
  2. Paste your markup into "Paste your markup", press "Sample" to load an example, or drop an .html, .htm, .vue, .svg or .xhtml file onto the drop zone.
  3. For Beautify, choose "Indent" (two spaces, four spaces or tabs) and "Wrap at" (never, 80, 100 or 120 columns). For Minify, decide whether to drop quotes around simple attribute values.
  4. Choose whether to tick "Keep comments".
  5. Read the result under "Formatted" or "Minified". Use the Preview tab to see it rendered, then "Copy" or download it as formatted.html or minified.html.

Features

  • Beautify with two-space, four-space or tab indentation
  • Optional line wrapping at 80, 100 or 120 columns
  • Minify that removes only whitespace nobody can see, with an option to remove quotes from simple attribute values
  • Contents of pre, textarea, script and style kept exactly as written
  • Unclosed tags and stray closing tags listed with their line numbers, up to the first eight shown
  • Element count, nesting depth, output size, and the percentage saved when minifying
  • A sandboxed rendered preview, with scripts blocked

Supported formats

Accepts pasted HTML or a file of up to 4 MB with the extension .html, .htm, .vue, .svg or .xhtml. Outputs HTML text, copied or downloaded as formatted.html or minified.html.

Tips

  • Fix the first problem in the list first. One missing closing tag often causes the later ones to be reported too.
  • Keep conditional comments. They are preserved even if you untick "Keep comments".
  • Minify only your final copy. Keep the beautified version as the one you edit.
  • Be aware that the preview still loads images and stylesheets given as web addresses, so previewing someone else's markup makes requests to their servers.

Frequently asked questions

Will beautifying change how my page looks?

It is designed not to. Inline elements such as links and bold text stay on the same line as their text, and the contents of pre and textarea are left untouched.

Does it fix broken HTML?

No. It reports unclosed and stray tags with line numbers so you can fix them yourself, rather than guessing what you meant.

Is it safe to preview HTML that contains scripts?

The preview runs in a sandboxed frame that blocks scripts, forms and navigation, so pasted scripts are shown but do not run.

Is my HTML uploaded?

No. The markup is formatted in your browser, and dropped files are read in the tab. Only the preview can make outside requests, for images or stylesheets the markup links to.

What does "Drop quotes around simple attribute values" do?

In Minify mode it removes the quotation marks from attribute values that need none, for example class="card" becomes class=card. Values with spaces or special characters keep their quotes.

What is the file size limit?

Dropped files can be up to 4 MB. Larger files are rejected with a message, and pasting is not limited by the tool itself.

Can I try this Pro tool without an account?

Yes. Format or minify up to 3,000 characters of HTML free. Pro removes this limit and adds downloads. Your own input is processed locally in your browser.

Will upgrading keep my work?

Checkout and login open in a separate tab. Keep the workspace open to retain inputs, settings and previews. Files stay in that tab only; keep the originals in case you close or reload it. Export access is checked with the server after payment.

Your files are processed directly in your browser and are not uploaded to HubToolify's servers.