Code Minifier & Beautifier
Minify or beautify HTML, CSS, and JavaScript in your browser. Remove comments, collapse whitespace, shorten hex colours, and auto-indent with configurable tab sizes. See size savings instantly. Free. No sign-up.
How it works
- 1Choose your language
Select HTML, CSS, or JavaScript from the language tabs. Each language uses a specialised minification and beautification engine optimised for its syntax.
- 2Pick a mode and paste code
Switch between Minify and Beautify mode. Paste your code, upload a file, or load a sample. Configure options like comment removal and indent size.
- 3Copy or download
Review the stats bar showing original size, output size, savings percentage, and compression ratio. Copy the result or download it as a file.
Why You Need a Code Minifier
Every kilobyte matters for web performance. Minifying your HTML, CSS, and JavaScript removes unnecessary characters — whitespace, comments, and redundant syntax — without changing how the code works. The result is smaller files that download faster, which directly improves your Core Web Vitals scores, Largest Contentful Paint, and overall page load speed.
Google uses page speed as a ranking factor. A code minifier is one of the simplest and most effective optimisations you can make. For a typical web page, minification reduces HTML by 10-20%, CSS by 20-40%, and JavaScript by 30-60%. These savings compound across every page view and every visitor.
The beautifier mode is equally valuable during development. When you need to debug production code, inspect a third-party script, or review minified CSS, the beautifier reformats everything with proper indentation and line breaks. Configurable indent sizes (2 spaces, 4 spaces, or tabs) let you match your project's coding standards.
This tool handles the most common minification tasks: removing HTML comments and optional closing tags, collapsing CSS whitespace and shortening hex colours, and stripping JavaScript comments while respecting string literals. For production builds, pair this with your build tool's minifier (Terser, cssnano, html-minifier) for maximum compression.
All processing happens entirely in your browser. Your code is never sent to a server, never logged, and never stored. The tool works offline once the page has loaded.