HTML Formatter & Minifier

Beautify messy or minified HTML with proper indentation, including inline CSS and JavaScript, or minify HTML for production. Free and client-side.

Runs 100% in your browser. Nothing you paste is uploaded.

Input HTML

Output

—

About the HTML Formatter

Paste minified or badly indented HTML and get clean, readable markup. Embedded <style> and <script> blocks are formatted too. Switch to Minify to strip comments and collapse whitespace for production.

Features

  • Indents nested elements correctly
  • Formats inline CSS and JavaScript
  • Configurable wrap length and indentation
  • Minify mode removes comments & whitespace
  • Preserves <pre> and <textarea> content

How to use it

  1. Paste HTML into the input pane.
  2. Pick Beautify or Minify and your indentation.
  3. Copy or download the output.

Frequently asked questions

Is the HTML validated?

The formatter is tolerant like a browser — it formats even invalid HTML. Use it to make structural problems visible rather than as a strict validator.

Is minification safe?

The minifier removes comments and collapses whitespace between tags, but keeps whitespace inside <pre>, <textarea> and scripts. Test the result in your target browsers as with any minifier.

Esc