Code Minifier

Shrink CSS, JavaScript, HTML, JSON and XML by removing comments and whitespace, and see how much you saved. Runs entirely in your browser.

Sponsored
This is a fast, safe structural minifier (it strips comments and needless whitespace). It is not a full compiler like Terser — it won't rename variables or do advanced optimisation, so the output stays behaviourally identical.
Sponsored

Frequently asked questions

Is the minified JavaScript safe to run?

Yes. The JS minifier only strips comments and collapses whitespace while preserving strings, template literals and regex contents, so behaviour is unchanged. It doesn't rename variables, so it won't break references — but for production builds a full tool like Terser compresses further.

Does minifying JSON validate it?

Yes. JSON is parsed and re-serialised, so invalid JSON is reported as an error rather than silently mangled.

Will HTML minifying break my page?

It removes comments (keeping IE conditional comments) and collapses whitespace between tags. This is safe for typical markup, though be mindful of significant whitespace inside <pre> or <textarea>.

Is my code uploaded?

No. All minification happens locally in your browser, so you can safely paste proprietary or sensitive code.

What this minifier does