Skip to content

HTML, CSS & JavaScript Minifier

Minify HTML, CSS and JavaScript with real parsers bundled into this page, then compare the size savings.

Runs entirely in your browser. Nothing is uploaded.

Engine: Terser
Before
0 B
After
—
Saved
—

Supports standard HTML5, CSS3 and ES2020+ JavaScript. TypeScript, JSX, Sass/SCSS and template-language syntax are not supported. Keep your original source and test minified output before deploying.

Step by step

How to use the HTML, CSS & JS Minifier

  1. 1

    Choose HTML, CSS or JavaScript.

  2. 2

    Paste your code into the input editor.

  3. 3

    Select Minify. Errors are reported with their location.

  4. 4

    Compare sizes, then copy or download the result.

What it does well

Terser for JavaScript

Parses modern ES2020+ syntax, removes whitespace and comments, shortens local names and simplifies expressions.

CSSO for CSS

Parses stylesheets into a syntax tree, merges rules and shortens values safely.

html-minifier-terser for HTML

Collapses whitespace, removes comments and minifies inline styles and scripts.

Size comparison

Byte sizes before and after, with the percentage saved.

Clear errors

Syntax errors are reported instead of producing broken output.

Who uses it

Front-end developers
Minify a snippet for a CMS or email template without a build tool.
Site owners
Shrink a custom script or stylesheet before pasting it into a site builder.
Learners
See how minifiers transform code.

Why parser-based minification matters

Removing whitespace with simple find-and-replace rules can break code: a regular expression cannot tell a comment marker inside a string from a real comment, and stripping a newline can change how JavaScript inserts semicolons. Parser-based minifiers build a full syntax tree first, so they understand strings, regular expressions, template literals and scope, and only apply transformations that keep the meaning identical.

This page uses three widely used open-source tools that run entirely in the browser: Terser for JavaScript, CSSO for CSS and html-minifier-terser for HTML. They are bundled locally and loaded only when you open this tool.

Supported syntax and limitations

JavaScript must be valid ES2020 or later; TypeScript, JSX and non-standard syntax are not supported. Top-level names are preserved so global functions keep working. CSS must be standard CSS; preprocessor syntax such as Sass nesting with variables is not supported. HTML minification keeps attribute quotes where needed and does not remove optional tags, which keeps the output safe for most templates, but templating syntax such as Handlebars may need testing. Always keep your original source and test minified output before deploying.

Frequently asked questions

Is my code uploaded?

No. All three minifiers run inside your browser.

Will minified JavaScript behave the same?

Terser preserves behavior for valid code. Code that relies on function names via Function.name may differ, so test before deploying.

Can I minify TypeScript or SCSS?

No. Compile them to JavaScript or CSS first, then minify the result.

Related tools