Skip to main content

HTML Minifier – Remove Whitespace & Comments Online

Minify HTML by removing comments and safe whitespace while preserving pre, textarea, script, and style contents. Compare size and download the result.

HTML Minifier

Strip whitespace and comments while preserving pre, script and style content

Ready

Minified HTML will appear here

Paste HTML above to begin

What is HTML Minifier?

Remove HTML whitespace and comments (IE conditional comments are kept) to potentially reduce page size. Content inside <pre>, <textarea>, <script>, and <style> tags is left untouched; this tool does not minify the CSS or JavaScript inside those blocks. Shows before/after byte counts and percentage reduction.

  • html
  • minifier
  • compress
  • whitespace
  • optimize

Features

What you get with HTML Minifier.

  • Size Comparison

    Shows original vs. minified byte count and percentage saved.

  • Whitespace-Safe

    Contents of pre, textarea, script, and style tags are preserved untouched.

  • Instant Results

    Output updates as you type or paste — no button press needed.

How to use HTML Minifier

Follow these steps to get the best results.

  1. Paste your HTML

    Paste your page or template markup into the input — minification runs as you type.

  2. Check the size savings

    Compare original and minified byte counts and the percentage saved.

  3. Copy or download the result

    Copy the minified HTML or download it as a file for deployment.

Advertisement

In-feed adResponsive

Frequently asked questions

Common questions about HTML Minifier.

The tool preserves content inside pre, textarea, script, and style tags exactly as written, since collapsing whitespace there can change rendering or break code. Everything else has whitespace and comments stripped safely.

Comments

Share feedback, ask questions, or help others use this tool.

Join the discussion

Sign in to comment, reply, and report inappropriate content.

Advertisement

Mobile banner adResponsive