How do I minify JavaScript, CSS or HTML?
Choose the code type, paste your code, and click Minify. The tool removes comments and unnecessary whitespace, shows the original size, minified size, percentage saved and line counts, and lets you copy the output or download it as a .min.js, .min.css or .min.html file. The built-in JavaScript sample (a small price calculator with comments) shrinks from 265 bytes to 207 bytes, saving 21.9% and going from 10 lines to 1. The CSS sample saves 29.5% (258 to 182 bytes) and the HTML sample saves 25.7% (304 to 226 bytes). Results update when you change options, and the Sample button loads a ready-made example for whichever code type is selected, so you can see exactly what the minifier does before trusting it with your own code.
What does minification actually remove?
Minification removes everything a browser does not need to run the code: comments, indentation, line breaks, spaces around punctuation, and (for JavaScript and CSS) semicolons that are redundant before a closing brace. It does not rename variables or restructure logic; that is the job of a full bundler or obfuscator. What remains is the same program in fewer bytes, which means faster downloads, faster parsing and better scores on speed tests like PageSpeed Insights and GTmetrix, which explicitly check for minified CSS and JavaScript. The savings add up on real projects: a typical hand-written stylesheet or script often shrinks by 20 to 40% from whitespace and comment removal alone, before gzip or Brotli compression on the server squeezes it further.
Is it safe? Will minification break my code?
This minifier is built to be conservative where it matters. In JavaScript, string literals, regular expressions and template literals are detected and kept byte-for-byte intact, so a URL inside a string is never mistaken for a comment and a regex is never confused with division. Spaces that the language requires are preserved: between keywords and identifiers, around plus and minus signs where removing them would create increment or decrement operators, and after numbers before a dot. In CSS, spaces inside calc() expressions and before media query parentheses are kept, because removing them would change the meaning. In HTML, the contents of pre, textarea, script and style elements are left untouched. Even so, always test minified code before deploying it, and keep your readable original as the source you edit.
What are the options for?
Remove comments strips line and block comments (and HTML comments) from the output. Keep important comments preserves license and copyright banners, meaning comments starting with an exclamation mark or containing license, preserve or copyright tags, which many open-source licenses require you to keep even in minified files. Remove unnecessary semicolons drops the final semicolon before a closing brace in JavaScript and CSS, a small but safe extra saving. All three are on by default for the smallest output; turn them off if you need comments kept for debugging or if a downstream tool expects the original punctuation. Changing any option re-minifies instantly so you can watch the size and savings update.
Minify, gzip, or both?
Both, because they do different jobs. Minification removes bytes that carry no meaning; gzip or Brotli compression then encodes the remaining bytes more efficiently for transfer, and the browser decompresses them on arrival. Minified code also compresses slightly better and parses faster once decompressed, because there is less text for the browser to scan. A common production setup is: minify during the build, serve with Brotli or gzip, and cache the files aggressively with versioned filenames. For a quick win on a small site, pasting a stylesheet or script through this minifier and replacing the file can noticeably improve load times, especially on mobile connections where every kilobyte counts. Check the before-and-after sizes in the stats panel to see exactly what you gained.
Is it free and private?
Yes. The code minifier is free, with no signup, no account and no limits. Minification runs entirely in your browser, so your source code is never sent to a server, stored or logged, and it disappears when you clear the boxes or close the tab. That matters for client work, unreleased projects and proprietary code. For developers shipping faster pages, students learning how minification works, and anyone who wants smaller JS, CSS and HTML files with clear size statistics and one-click copy or download, this page does the job in seconds.