Code Minifier & Beautifier for JS, CSS & HTML
Minify or beautify JavaScript, CSS, and HTML in your browser with byte and gzip size stats.
Compress JavaScript with Terser, CSS with csso, and HTML with html-minifier-terser, or reformat any of the three with Prettier. The stats row shows input size, output size, percentage change, and the gzipped size of the result, so you can see what the change actually saves on the wire.
This tool runs the same engines that production build pipelines use, directly in your browser. JavaScript is compressed with Terser, which renames local variables, removes dead code, and collapses expressions. CSS goes through csso, which merges duplicate rules and shortens values. HTML is processed by html-minifier-terser with whitespace collapsing, comment removal, and inline CSS and JS minification enabled. Switching the mode to Beautify formats the same input with Prettier instead, using its babel, postcss, and html parsers, which is useful for reading minified code you found in a bundle or a page source.
The stats row answers the question minifiers usually leave open: how much does this matter after compression? Alongside raw input and output bytes and the percentage change, the tool gzips the output with pako and shows the compressed size, which is much closer to what a server actually transfers. A file that shrinks 40 percent raw often shrinks far less after gzip, because gzip already removes the repetition that minification targets.
Syntax errors are reported rather than swallowed. Terser failures include the line and column where parsing stopped, and Prettier errors include a code frame pointing at the offending token, so you can fix the input instead of guessing. The editors use CodeMirror with syntax highlighting for all three languages.
- 1
Pick a language and mode
Choose JavaScript, CSS, or HTML, then select Minify to compress or Beautify to reformat with Prettier. Both choices are remembered for your next visit.
- 2
Paste your code
Drop the source into the input editor. The first run downloads the minify and format engines (about 3 MB), which are then cached.
- 3
Run and grab the result
Click the action button, review the output and the size stats including gzipped bytes, then copy the result or download it as a file.
Shrink an inline script
Minify a small script that gets embedded in an HTML template or email where no build step exists.
Read minified vendor code
Paste a one-line bundle from a page source and beautify it to debug what a third-party script is doing.
Check real transfer savings
Compare the gzipped size before and after minification to decide whether a change is worth shipping.
Clean up legacy CSS
Run an old hand-written stylesheet through csso to merge duplicate rules, then beautify the result for the repository.
Is my code uploaded anywhere?
No. Terser, csso, html-minifier-terser, and Prettier all run inside your browser tab. The code you paste never leaves your machine, which also makes the tool safe for proprietary source.
Which engines does the tool use?
Terser for JavaScript minification, csso for CSS, html-minifier-terser for HTML, and Prettier (babel, postcss, and html parsers) for beautifying. These are the same libraries used by common build pipelines.
Why is the gzipped size shown?
Servers usually compress responses with gzip or brotli, so raw byte savings overstate the benefit. The tool gzips the output with pako and shows that size, which is closer to actual transfer cost.
What happens if my code has a syntax error?
The run stops and the parser's error is shown. Terser reports the line and column where parsing failed, and Prettier includes a code frame pointing at the problem token.
Does minifying JavaScript change its behavior?
Terser performs semantics-preserving transforms by default: renaming local variables, dropping unreachable code, and shortening expressions. Code relying on Function.prototype.toString or local variable names via eval can break, which is rare.