Free Tool

HTML
Minifier

Remove comments, collapse whitespace, and reduce your HTML file size. Fast, free, and entirely in your browser.

How It Works

Step 01

Paste HTML

Paste or type your HTML code into the input area.

Step 02

Minify

Click Minify to remove comments and collapse whitespace.

Step 03

Copy or Download

Copy the minified code or download it as an .html file.

Minify HTML online to reduce page weight, save bandwidth, and improve Core Web Vitals scores. ConverterUp's HTML minifier removes comments and collapses whitespace — including the gaps between tags — while leaving your markup and attributes untouched. Front-end developers and static-site builders can paste their template, click minify, see the savings, and copy or download the smaller file. Minification runs in your browser, so proprietary markup, internal templates, and unreleased landing pages stay completely private.

What gets removed during minification

Whitespace is the biggest win. Hand-written HTML and template-engine output contain hundreds of newlines, tabs, and runs of spaces that the browser never renders. The minifier collapses every whitespace sequence to a single space and removes the whitespace between tags, typically shaving 15–25 % off raw size before gzip.

Comments () are stripped, including conditional comments for old Internet Explorer and server-side include directives — if your templates rely on those, keep them out of the minifier.

Optional tags per the HTML5 spec — the closing ,

, , , and several others — can be omitted because the parser infers them. ConverterUp does not remove them: it only strips comments and whitespace, which keeps the output safe to open in any editor.

Heavier optimizations — dropping redundant attributes like type='text/javascript', removing quotes around attribute values, collapsing boolean attributes — are left to build tools such as html-minifier-terser. ConverterUp keeps attributes exactly as written.

When NOT to minify HTML

Never minify the file you commit to source control. Minified HTML is unreadable, undiffable, and impossible to review in a PR. Keep the source template human-readable and minify only the build artifact that goes to the CDN. The same rule applies to email templates, MJML output, and JSX/template engine output.

Skip minification during local development. Source maps for HTML do not exist (unlike JS/CSS), so a broken minified template is much harder to debug than a broken source template. Most dev servers (Vite, Next.js, Astro) serve unminified HTML in development and minify only in production builds.

Avoid minifying inside template engines that depend on whitespace semantics. Liquid, Handlebars, EJS, and Jinja generally tolerate whitespace removal, but Pug/Jade and Slim are whitespace-sensitive by design — minifying their output post-render is fine; minifying the template itself is destructive. Same for Markdown and MDX sources.

Be careful with

,