Skip to content
Toolars
Explore

HTML Minifier

Minify HTML in a local Worker — comments removed, whitespace preserved — with byte statistics on up to 256 KiB of markup.

Local processing

Processing details

Tool inputs are processed on your device.

Resources may be downloaded to run this tool. Account services are separate.

Offline resources have not been prepared.

Privacy information
Report bug

Task path / input to outcome

How to minify HTML

  1. 01

    Paste the markup

    Paste UTF-8 source up to 256 KiB. The indent control is disabled for Minify.

  2. 02

    Try the sample first

    Sample loaded. Run the local transformation when ready.

  3. 03

    Press Minify

    Press Minify to remove HTML comments without collapsing HTML whitespace. Inline CSS and JavaScript remain unchanged. Check the output in the target page.

  4. 04

    Check the statistics

    Compare UTF-8 input and output bytes and the savings percentage. A negative saving means the result grew; inspect it before copying or downloading.

  5. 05

    Copy or download the result

    Use Copy result for the clipboard or Download to save toolars.min.html. Reset clears the panes for the next document, and the statistics reset along with the workspace.

Tool facts

Processing
In your browser
Input leaves this device
Never
Retention
Nothing is stored
Price
Free

Your input stays in the browser.

HTML Minifier uses its verified local execution path and does not create a hidden input or output history.

Local execution

Runs inside the current browser tab.

No hidden processing

Active tool data never becomes a Toolars document record.

No account required

Use the core workflow without creating a profile. Favorites sync to your account after you sign in.

Immediate reset

Clear the tab and the active working data is gone.

When HTML Minifier is useful

Code reviews

Make source easier to inspect before sharing it with another developer.

Build artifacts

Create compact HTML, CSS, or JavaScript without executing the source.

Copy-ready snippets

Format a focused example and move it directly into documentation or an editor.

What HTML Minifier actually does

For a generated email template containing review comments, paste a representative excerpt, minify it, and compare it with the original in the email renderer. Inspect whitespace-sensitive copy and embedded styles before downloading.

Common questions

What does the minifier remove?
It removes HTML comments and shortens supported markup without collapsing whitespace. It does not minify embedded style or script code.
Which engine does the minifying?
HTML is parsed with Prettier and minified with html-minifier-terser inside a local Worker. The configuration preserves HTML whitespace and disables inline CSS and JavaScript minification. Review template output in the application where it will run.
Does it minify inline CSS and JavaScript too?
No. Style and script blocks inside the markup are left untouched — only the HTML structure is minified, and the markup around those blocks still shrinks normally. Minify the embedded parts separately with the dedicated CSS and JavaScript tools, which share the same 256 KiB budget and the same local-only contract.
Why did my output grow instead of shrink?
This configuration preserves whitespace, quotes and optional tags, so removing comments may save little; serialized markup can even be larger. Compare the byte counts and keep the original.
What are the limits, and how are errors handled?
Input is limited to 256 KiB and output to 512 KiB. The local Worker has separate five-second startup and run budgets; editing or Cancel stops it. Source stays in this browser; nothing is uploaded.
Is my markup uploaded or executed?
No. Source is parsed inside a local Worker and is never executed, uploaded or saved. Parser acceptance is not application correctness or browser compatibility.

Related tasks, not a dead end.

Move into another focused workspace without returning to the full index.

URL Workbench

Clean URL lists with signed-link protection and per-line reasons. Compare components and export sitemaps.

Edit

JSON Explorer

Query JSONPath, extract fields and round-trip JSON Pointer records without losing large-number precision.

Inspect

JSON Schema Validator

Validate Draft 7 or 2020-12 locally with exact error paths; infer schemas from multiple observed samples.

Inspect

HTML Publishing

Clean pasted HTML for publishing while preserving lists, links and table semantics; preview changes safely.

Publish