HTML Formatter
Beautify and indent HTML markup.
OpenCompact a script by dropping comments and spacing, while string contents stay exactly as written.
Add a snippet or drop a .js file, ideally with semicolons in place.
Line and block comments are removed; strings are left alone.
Only spaces between identifiers and keywords survive.
Copy the result or download min.js, then run it once to confirm.
You have a bookmarklet, an analytics snippet or a small widget script that needs to fit on one line in a CMS field. A full bundler is overkill, but deleting whitespace by hand risks breaking a string.
The minifier scans the code once, tracking whether it is inside a string, a // comment or a /* */ comment. Comments are dropped. Whitespace is removed unless it separates two identifier characters, so const x keeps its space while spaces around operators and braces disappear. Characters inside single, double and backtick quotes are copied untouched. Output updates live and downloads as min.js.
The important limit is that line breaks are not treated as statement ends. Code that relies on automatic semicolon insertion, such as two assignments on separate lines without semicolons, is joined into one invalid line. Add semicolons first and test the result. Regex literals containing quote characters or // can also be misread as strings or comments, and variable names are not shortened. To read the output again, use the JavaScript Formatter. For config payloads the JSON minifier is safer because it parses the data, and you can compress your styles the same way.
The code is only scanned for whitespace and comments in this tab; it is never executed or sent anywhere.
Keyboard shortcut
Answers for this tool. For site-wide help, open the FAQ hub.
No. It only removes comments and whitespace. Renaming, dead code removal and other compression require a real parser, which this lightweight tool does not include.
No. Every comment is removed, including /*! ... */ license banners. Paste the banner back at the top of the output if your license requires it.
The usual cause is a missing semicolon at the end of a line. Once line breaks are gone, the next statement runs straight on. Add semicolons to the source and minify again.