Minify HTML Online — Free HTML Minifier

Minify HTML documents instantly with our free online tool. Select, reorder, concatenate and minify multiple .html files as one bundle with your current options. All processing in your browser.

Loading…
HTML Minification
Minify HTML online. Strip comments and extra whitespace in the browser — not gzip.

Features

Remove comments and extra whitespace from HTML documents to shrink the markup you ship. Processing stays in your browser.

Minify HTML

Remove comments and extra whitespace from HTML documents to shrink the markup you ship. Processing stays in your browser.

Basic example

Input HTML

<!DOCTYPE html> <html> <head> <title>Checkout Dashboard</title> <meta charset="utf-8" /> </head> <body> <header class="site-header"> <h1>FastMinify Store</h1> </header> <main> <section class="cart"> <h2>Your cart</h2> <p>3 items ready for checkout.</p> </section> </main> </body> </html>

Minified HTML

<!DOCTYPE html><html><head><title>Checkout Dashboard</title><meta charset="utf-8" /></head><body><header class="site-header"><h1>FastMinify Store</h1></header><main><section class="cart"><h2>Your cart</h2><p>3 items ready for checkout.</p></section></main></body></html>

Why Minify HTML?

HTML minification is useful when the markup you ship still carries comments, indentation, and extra spaces the browser does not need to paint the page. Removing that overhead shrinks the HTML payload — fewer bytes to transfer on the first request, before CSS and JavaScript even start. That source-level shrink complements gzip or Brotli: minification densifies the text; transfer compression still belongs on the server or CDN. See our gzip and Brotli guide. Neither layer replaces the other. A correct minifier must not change visible content or the rendering you expect. FastMinify targets comments and whitespace in the browser. It does not rewrite your DOM, and it does not promise a specific performance gain on every site.

What FastMinify Removes

When Remove comments is on, FastMinify deletes HTML comments (&lt;!-- … --&gt;), including IE conditional comments. Whitespace between tags is always collapsed to &gt;&lt;, even if Collapse whitespace is off. When that option is on, remaining space, tab, and newline runs become a single space. Spaces around = in attributes are always normalized (class = "x" becomes class="x"). This tool does not remove optional attribute quotes, optional closing tags, redundant attributes, or empty attribute values. It does not minify CSS or JavaScript inside &lt;style&gt;, &lt;script&gt;, or event handlers. It is not gzip or Brotli.

Minification options

Remove Comments
Removes all HTML comments from code

Comparison with/without option:

Original code
<div> <!-- This is a comment --> <p>Content</p> <!-- Another comment --> </div>
With removeComments: true
<div><p>Content</p></div>
With removeComments: false
<div><!-- This is a comment --><p>Content</p><!-- Another comment --></div>
Collapse Whitespace
Collapses multiple whitespace characters into single spaces

Comparison with/without option:

Original code
<div> <p> Multiple spaces </p> <span> Text </span> </div>
With collapseWhitespace: true
<div><p> Multiple spaces </p><span> Text </span></div>
With collapseWhitespace: false
<div><p> Multiple spaces </p><span> Text </span></div>

See Beautify indentation options →

Need to unminify HTML? Open the HTML unminifier →

Concatenating HTML Files

On Minify HTML, select or drop multiple .html or .htm files, reorder them, then concatenate and minify the complete bundle once with your current options. Processing stays in your browser. Optional file markers, comments and extra spacing are added before minification and may be removed from the final output.

Frequently Asked Questions — Minify

Everything about minification

Does minifying HTML replace gzip or Brotli?

No. Minification shrinks the source (comments and whitespace). gzip and Brotli still compress bytes on the wire. This tool only does the first step — see gzip and Brotli for transfer compression.

Need to unminify HTML?

Use our HTML unminifier for debugging production markup.

Need to beautify HTML?

Use our HTML beautifier for consistent markup formatting.

How do I concatenate and minify multiple HTML files?

On Minify HTML, use the concat button or drop two or more .html or .htm files on the input panel, reorder them, then concatenate and minify the complete bundle once with your current options. Everything runs in your browser. This workflow is not available on Beautify HTML or Unminify HTML, and file markers, comments or extra spacing may be removed during minification.

Verify it yourself

FastMinify processes your input in the browser. Inspect the network panel or read our validation gate to confirm nothing leaves your device.

Minify

Shrink code and assets for production — minify JavaScript, CSS, HTML, JSON and XML before gzip or CDN deploy.

Explore other tool categories

Beautify

Make code readable with consistent indentation — beautify JavaScript, CSS, TypeScript, SCSS, LESS, Markdown, GraphQL, SQL, YAML and more in your browser.

Unminify

Expand minified or compressed code — unminify JavaScript, CSS, TypeScript, SCSS, LESS, SQL, YAML and other formats when debugging or reviewing.

Conversion

Transform data between JSON, YAML, XML and CSV locally — no server uploads.

CSS preprocessors

Compile SCSS or LESS to standard CSS in the browser — pair with beautify or minify for a full stylesheet workflow.

JSON Tools

Validate, format, diff and explore JSON payloads — complementary to minifiers and converters.

SVG Tools

Preview, optimize with SVGO, export Data URI, resize, beautify, convert to JSX and validate SVG — all in your browser.

DevOps & Infra

Terraform HCL format/validate/minify, Dockerfile format & lint, Docker Compose and .env validation.

CI/CD

GitHub Actions and GitLab CI — format YAML and check workflow/job structure in your browser.

Logs & observability

Line-oriented JSON/NDJSON and Nginx/Apache access logs — format, filter, validate, and CSV/TSV.

Kubernetes

Multi-doc manifests, structural validate, Ingress/Deployment starters, and Helm values formatting.

Networking / IP

CIDR, subnets, and IPv4/IPv6 helpers — in your browser.

Security & tokens

JWKS, X.509 certificates, and secrets scan — browser-local.

API & schemas

OpenAPI tools to format, validate, and lint your specs.

HTTP Tools

Paste-local cURL, HTTP messages, and URLs — format and inspect in your browser, never sent.

Encoding

Encode or decode Base64, URL components and HTML entities — client-side only.

Developer utilities

Timestamps, UUID, ULID, Nanoid, cron, passwords, regex, slugify, number bases, case, text diff, and chmod — all client-side.

Text & Markdown

Count words, build Markdown TOCs, and clean line lists — all in your browser.

AI & LLM

Token counting, pricing estimates, and context-window fit — 100% browser-local.

Test Data

Synthetic field values for fixtures and DB seed — reserved-range phone numbers first.

Serialization

Serialize and deserialize PHP data structures beside JSON workflows.