This code minifier shrinks JavaScript, CSS and HTML by removing spaces, comments and other characters the browser does not need. It is built for web developers, site owners and anyone who wants smaller files and faster pages. It is free to use, and your code is processed in your browser, so nothing is uploaded.
How to use the code minifier
- Choose the language: JavaScript, CSS or HTML.
- Paste your code into the input box.
- Click Minify.
- Check the size saving shown, then copy the result.

This tool pairs well with the HTML / CSS / JS Beautifier. If you do this kind of job often, the JSON Formatter & Validator and the JSON to XML / XML to JSON can save you time too.
Paste one language at a time. A CSS block pasted into the JavaScript option will not work, because each language is handled by its own rules.
What does minifying code actually do?
Minifying removes everything a browser ignores. That means line breaks, indentation, extra spaces and comments. The code behaves the same, but the file is smaller, so it downloads faster.
JavaScript is minified with Terser, a widely used minifier. Because of that, variable names in your script may come out shorter than what you wrote. That is normal and part of why the file shrinks.

What is a JS, CSS and HTML minifier good for?
- Faster page loads. Smaller scripts and stylesheets mean less to download before a page shows up.
- Cleaning up before launch. Run your final CSS and JavaScript through the tool before you upload them to your site.
- Small sites and landing pages. If you do not use a build tool, you can minify a file by hand in a minute.
- Inline snippets. Tracking code, widgets and email-friendly HTML are easier to embed when they are compact.
- Quick size checks. The size saving shown after you click Minify tells you how much a file really weighs in extra characters.
Tips for getting the best results
- Keep your original file. Minified code is hard to read and edit. Save the readable version and only publish the minified copy.
- Test after minifying. Load the page and click through it. This takes a minute and catches most problems early.
- Fix errors first. A missing bracket or unclosed tag in your input is easier to find before minifying than after.
- Do not minify twice. Files that already end in .min.js or .min.css are minified. Running them again gains you little.
- Watch your comments. Comments are removed. If a comment holds licence or author information you must keep, add it back to the published file.
- Name files clearly. Something like style.min.css next to style.css makes it obvious which one is which.
Why does my minified code not work?
Most of the time the problem was already in the source. Minifying makes small mistakes more visible.
- JavaScript errors. A syntax error in your original script can stop Terser from producing output. Check the code runs before you paste it in.
- Code that depends on exact names. If other scripts or HTML attributes refer to a function by its original name, shortened names can break the link. Compare the result with your page.
- HTML spacing. Removing whitespace between inline elements can change how text looks. Preview the page after minifying HTML.
- Wrong language selected. If the output looks odd or empty, check you chose the right option before clicking Minify.
Which language gets which kind of cleanup?
| Language | What the minifier removes | What to check afterwards |
|---|---|---|
| JavaScript (Terser) | Spaces, comments, unneeded characters; names may be shortened | Page features and console errors |
| CSS | Spaces, line breaks, comments | Layout and styling on key pages |
| HTML | Spaces, line breaks, comments | Text spacing and page structure |
Can you turn minified code back into readable code?
Partly. The Code Beautifier can add line breaks and indentation again so you can read the code. It cannot restore shortened variable names or deleted comments, so keep your original source safe.
