Code Minifier
Minify HTML, CSS, or JavaScript in one click. Strips comments, whitespace, and unnecessary bytes. See exactly how much you save.
Input — HTML
0 BWhat is code minification?
Minification removes all unnecessary characters from source code without changing its functionality. This includes whitespace, newlines, comments, and shortening values (like hex colors). Minified code loads faster because there are fewer bytes to download — critical for web performance and Core Web Vitals.
Optimizations by language
HTML
Comments, inter-tag whitespace, redundant attributes, type attributes
CSS
Comments, whitespace, last semicolons, hex shorthand, zero units, leading zeros
JavaScript
Single/multi-line comments, whitespace, empty lines, operator spacing
Frequently Asked Questions
What languages can I minify?
HTML, CSS, and JavaScript. Select the language tab, paste your code, and click Minify. The tool auto-detects common patterns but you should select the correct language for best results.
How much space does minification save?
Typically 20-60% for CSS, 30-70% for HTML (depending on whitespace), and 20-50% for JavaScript. Heavily commented code saves even more. The tool shows exact byte savings and percentage.
Is the minified output safe to use in production?
For HTML and CSS — yes, the output is functionally identical. For JavaScript, this is a basic regex-based minifier suitable for simple scripts. For complex production JS (with ES modules, async/await, etc.), we recommend Terser or esbuild for full safety.
Does it rename variables (obfuscation)?
No. This tool only removes whitespace and comments — it does NOT rename variables, mangle function names, or obfuscate code. Your code remains readable if reformatted.
Is my code uploaded to a server?
No. All minification happens 100% in your browser using JavaScript regex operations. Nothing leaves your device.
What specific optimizations does the CSS minifier do?
Removes comments, collapses whitespace, removes spaces around selectors/properties, removes last semicolons before }, shortens hex colors (#ffffff → #fff), removes leading zeros (0.5 → .5), and strips units from zero values (0px → 0).
Related tools
More free, private, browser-based utilities — no upload, no sign-up.

Davemi Tools