Code Minifier
Minify HTML, CSS, and JavaScript. Remove comments and whitespace to reduce file sizes.
Why minify code?
Minification removes unnecessary characters from code without changing functionality. It reduces file sizes, speeds up page loads, and saves bandwidth. Every kilobyte matters on mobile networks.
What gets removed?
- Comments — Both single-line and multi-line comments are removed.
- Whitespace — Spaces, tabs, and newlines are removed or minimized.
- Optional characters — Semicolons and other characters that JavaScript doesn't require.
HTML minification
- Removes comments ( patterns)
- Collapses whitespace between tags
- Removes newlines
CSS minification
- Removes comments (/* */ patterns)
- Removes whitespace around selectors and properties
- Removes last semicolon in each rule
JavaScript minification
- Removes comments (// and /* */ patterns)
- Removes unnecessary whitespace
- Preserves keywords and syntax
Best practices
Always keep unminified versions in source control. Use build tools (webpack, Parcel, esbuild) for production to minify automatically. This simple tool is useful for quick checks or small files.