BrainCoder
DeveloperNothing uploaded

HTML Minifier

Minify and pretty-print HTML

Free forever — no sign-up, nothing uploaded. Files never leave your device.

braincoder.app/use/html-minifier

HTML Minifier

Minify and pretty-print HTML

Drop your file here

or browse from your device

Browse files

document.pdf

1.2 MB

report.pdf

860 KB

100% private

Nothing is uploaded — everything runs in your browser.

Free forever

No account or payment required.

No sign-up

Open the tool and start using it right away.

Local processing

Processing time depends on your input and device.

About this tool

Strip comments and whitespace from HTML or reformat messy markup into indented structure.

The HTML Minifier shrinks HTML by removing comments and collapsing whitespace that browsers ignore, producing a smaller file without touching the content that matters. Whitespace inside <pre> and <textarea> is preserved, JavaScript and CSS inside <script> and <style> passes through untouched, and values inside attributes are never rewritten — so minifying real-world markup stays safe.

Switch to pretty-print mode to reformat messy markup into clean indented structure, keep conditional comments like <!--[if IE]> when you need them, open a local .html file to process, and download the result when you're done. The header shows exact sizes in bytes and characters with the savings percentage, so you can see what you actually gained.

All processing happens in your browser with zero server uploads. Sensitive HTML containing API keys or internal URLs never leaves your machine.

Key features

Everything you get with HTML Minifier — no premium upsell.

Removes comments and collapses non-essential whitespace in one pass

Preserves whitespace in pre, textarea, script and style, plus quoted attribute values

Option to keep conditional comments (e.g. <!--[if IE]>)

Pretty-print mode reformats messy markup into indented structure

Live byte and character sizes with savings percentage

Open local .html files and download the result — fully client-side

How to use HTML Minifier

Follow the steps below to use the tool.

  1. 1

    Paste or open HTML

    Paste markup into the editor, or use Open .html to load a local file into the tool.

  2. 2

    Choose Minify or Pretty-print

    Minify strips comments and collapses non-essential whitespace. Pretty-print reindents the markup instead.

  3. 3

    Keep conditional comments (optional)

    In Minify mode, tick Keep conditional comments to preserve constructs like <!--[if IE]>...<![endif]-->.

  4. 4

    Copy or download

    Copy the result to your clipboard, or download it as a .html file.

Still free, still private — your files never leave your device.

Launch HTML Minifier

Frequently asked questions

Quick answers before you launch the tool.