1. Home
  2. Web & SEO
  3. HTML, CSS & JS Minifier

HTML, CSS & JS Minifier

Minify HTML, CSS and JavaScript: remove comments and whitespace and shorten code safely, with the size saved and a gzip estimate.

Runs in your browser
Language

Minified

Waiting for input.

What is the HTML, CSS & JS Minifier?

Minifying removes everything a browser does not need: comments, indentation, line breaks and, for JavaScript, long variable names. Smaller files download and parse faster, which helps page speed scores and users on slow mobile connections.

Paste code or upload a file and choose the language (or let the tool detect it). CSS and HTML are minified with careful rules that never change how a page looks: text inside quotes, <pre> blocks and important comments are kept. JavaScript is minified with Terser, the same engine many build tools use, with options to rename variables, drop console calls and keep licence comments. You see the size before and after, and an estimate of the gzip size your server would send.

How to use it

  1. Paste HTML, CSS or JavaScript, or upload a file.
  2. Choose the language, or leave it on Detect.
  3. Pick options such as keeping licence comments or shortening variable names.
  4. Copy or download the minified code.

Example

Input
/* Button */
.btn {
  color : #ffffff;
  padding: 0.5rem 1rem;
}
Output
.btn{color:#fff;padding:.5rem 1rem}

Features

  • Three languages. HTML (with inline CSS and JS), CSS and modern JavaScript (ES2023).
  • Safe by default. Strings, <pre> and <textarea> content and calc() expressions are never broken.
  • Terser for JavaScript. Dead-code removal, shorter names and optional console removal.
  • Keeps licences. Optionally keep /*! … */ and @license comments.
  • Size report. Bytes before and after, percentage saved and an estimated gzip size.
  • Private. Everything runs in your browser; your code is not uploaded.

Frequently asked questions

Is minified code safe to use in production?

Yes, that is what it is for. Keep your original, readable files for editing, and serve the minified versions. Test the page after minifying, especially JavaScript with “shorten names” on.

How much smaller will my files get?

Typically 20–40% for CSS and HTML and 40–60% for JavaScript, before compression. Gzip or Brotli on the server then shrinks the minified file much further.

What is the difference between minifying and gzip?

Minifying rewrites the code to remove what is not needed. Gzip and Brotli compress the bytes during download and are undone by the browser. Use both: minify at build time and enable compression on your server or CDN.

Can I un-minify code?

Formatting can be restored with a beautifier, but comments and original variable names removed by minifying cannot come back. Always keep your source files.

Last updated · Free, no sign-up, runs in your browser.

Free for everyone, kept free by you.

No paywall, no sign-up and no watermarks. If a tool saved you time, you can chip in any amount by UPI to keep Nova Free Tools running.

Esc
↑↓ move↵ openEsc close