Developer & Text Tools

HTML Minifier & Beautifier

Beautify HTML with clean indentation or minify it for production. Text in <pre> and <textarea>, scripts, styles and the spaces between inline elements are preserved, so the page renders the same.
Runs in your browserLive result

Workspace

Options

Conditional comments (<!--[if …]>) are kept.

How to use this tool

  1. 1Paste HTML, open a file or load the example.
  2. 2Choose Beautify or Minify.
  3. 3Copy or download the result.

Frequently asked questions

Whitespace inside <pre> and <textarea> is shown to visitors, so changing it would change the page. The formatter copies those blocks, and <script> and <style> contents, through unchanged.

The formatter keeps the spaces between inline elements such as <b>, <a> and <span>, which is where most formatters accidentally join or split words. Block-level elements are put on their own lines, which browsers ignore.

No. It reformats what you paste and leaves unclosed or misnested tags as they are, so it never silently changes your document structure.

No. Everything runs in your browser with JavaScript. The text you paste is not uploaded, logged or stored by MuhammadLab.