JavaScript formatter
Free online JS minifier and formatter. Format and compress JavaScript code with customizable indentation.
How it works
- 1
Paste the JavaScript code
Copy your JS code and paste it into the input field: functions, classes, modules or even entire files.
- 2
Choose Format or Minify
Click Format to indent with readable structure or Minify to compress by removing comments, spaces and empty lines while maintaining functionality.
- 3
Copy the optimized result
Check the size and savings statistics, then copy the transformed code: the minified version is production-ready.
FAQ
Can minification break the code?
In rare cases with code that depends on specific whitespace. For standard JavaScript the minification is safe and doesn't alter behavior.
Is it better than Terser or UglifyJS?
This tool offers basic minification (removing spaces and comments). For production with advanced obfuscation and tree-shaking, use Terser in your build system.
Does the formatter preserve comments?
In formatting, comments are removed for cleanliness. In the original version of the code they are preserved until minification.