Code Minifier
Free code minifier for HTML, CSS and JavaScript. Shrink files, keep licence comments, beautify CSS or JS and see bytes saved. Private — runs in your browser.
- No upload — 100% private
- Instant, on your device
- Free, no sign-up
- Works offline once loaded
How it works
How to use Code Minifier
Paste HTML, CSS or JavaScript, open a file or load the sample — the language is detected automatically.
Pick Minify or Beautify (CSS and JavaScript), and fine-tune options such as mangling names or keeping licence comments.
If there is a syntax error, read the exact line and column, then jump straight to it.
Compare the original and minified size, then copy the result or save it as a .min file.
Why use it
Why use our Code Minifier tool
Three languages, one tool
Minifies HTML, CSS and JavaScript, with auto-detection or manual tabs — no need to switch between sites.
Production-grade JavaScript
Uses terser, the minifier behind most build tools, with name mangling, dead-code removal and ES module support.
Safe CSS minification
Strips comments and whitespace without breaking strings, url() paths, calc() expressions or descendant selectors, and drops the last semicolon in each block.
Smart HTML whitespace
Collapses whitespace but leaves <pre>, <textarea>, <script> and <style> untouched, keeps IE conditional comments and can minify inline CSS and JS.
Size savings at a glance
Shows the original size, the result and the percentage saved, so you can see what each option is worth.
Private by design
Your code is processed on your device and never uploaded — safe for proprietary source and unreleased projects.
FAQ
Frequently asked questions
What does minifying code do?
Minifying removes everything a browser doesn't need — comments, indentation, line breaks and optional characters — and, for JavaScript, shortens variable names. The code works exactly the same but downloads and parses faster.
Will minification break my JavaScript?
Not if the code is valid. Terser understands the full language and only renames local variables, so global names your HTML relies on keep working. If your code has a syntax error, the tool shows the line and column instead of producing broken output.
Why are some comments kept?
Comments starting with /*! or containing @license or @preserve usually hold copyright notices that licences such as MIT require you to keep. Turn off Keep licence comments to remove them too. In CSS, /*! comments are always kept.
Is whitespace in my HTML text safe?
Yes. Runs of spaces and line breaks become a single space, which is how browsers display them anyway. Whitespace is only removed entirely next to block elements like <div> and <p>, and never inside <pre> or <textarea>.
Can I un-minify or beautify code?
Yes, for CSS and JavaScript. Choose Beautify to re-indent minified code so it is readable again. Original variable names and removed comments cannot be recovered.
Is my code uploaded anywhere?
No. Minification runs entirely in your browser. Nothing is sent to a server, logged or stored.
Related tools
JSON Formatter
Beautify, validate, minify and explore JSON as a tree.
SVG Optimizer
Shrink SVG files with SVGO, preview the result and export PNG.
HTML Entity Encode & Decode
Escape text to HTML entities or decode entities back to text.
Diff Checker
Compare two texts side by side with word-level highlights.
Base64 Encode & Decode
Encode or decode Base64 text, files, images and data URIs.
URL Encode & Decode
Percent-encode, decode and edit URL query parameters.
Hash Generator
MD5, SHA-1, SHA-256, SHA-512 and HMAC for text or files.
UUID Generator
Generate v4 and v7 UUIDs in bulk, then validate and decode.