Back to home

Code Minifier and Beautifier

Shrink code for production or make minified code readable again. Pick the language, paste your code and choose minify or beautify.

  1. Choose JavaScript, CSS or HTML
  2. Choose minify or beautify and paste the code
  3. Copy or download the result
Loading the tool...

Your files never leave your device

Minify and beautify

Minifying removes everything a browser does not need, such as comments, line breaks and extra spaces, so files download faster. Beautifying does the opposite: it indents minified code so a human can read it. Choose JavaScript, CSS or HTML, paste your code, choose the action, then copy or download the result.

A worked example

A CSS file with comments and one rule per line may shrink by a third or more after minifying, and a JavaScript file with long variable names can shrink even further. For a debugging session, take a minified script from a website, choose Beautify, and you get indented lines you can read, although the original variable names cannot be restored.

Limits and good practice

Keep your original source files and publish only the minified copy, because minified code is hard to maintain. If JavaScript has a syntax error, the tool shows an error message pointing to the problem instead of producing broken output. Unusual code, for example code that depends on function names, can behave differently after renaming, so run your tests on the minified version. For large projects a build tool does the same job automatically.

Frequently asked questions

Is my code uploaded?

No. Everything runs in your browser, so your code stays on your device.

Does minifying change how my code works?

It should not, but always test. Unusual code can behave differently after variables are renamed or unused code is removed.

Why did my JavaScript give an error?

The code has a syntax error, such as a missing bracket or quote. The message shows where the problem is, and the tool does not produce output until it is fixed.

Can I make minified code readable again?

Yes. Choose Beautify and the code is indented and spaced. Original variable names and comments cannot be restored.

Are comments kept?

Minify removes them. Beautify keeps whatever is still present in the code you paste.

Does it handle modern JavaScript?

Yes, including ES modules and current syntax such as arrow functions, classes and template strings.

Related tools

Save this tool to use it later

Add this page to your browser bookmarks by pressing Ctrl + D