Workspace Files stay on your device
code · minify
JS Minifier (safe)
Removes // and /* */ comments and leading indentation, blank lines and trailing spaces — a safe, conservative minify: strings and template literals are respected, statements are never joined (no ASI hazards), and nothing is renamed. Regex literals containing // are the one known limitation, and the note says so.
A little guidance. A better result.
How to use JS Minifier (safe)
Comments, indentation and blank lines removed; strings respected, statements never joined.
Prepare your input
Paste JavaScript or load a source file.
Use the workspace
Review the compacted output.
Check your result
Run your existing tests before using the result.
Know the limits
Regex literals containing comment-like sequences are a known limitation. This is not a replacement for a parser-based production minifier.
Where does my input go?
This browser tool processes your input on your device. Optional analytics is a separate choice; it is not needed to use the tool. Keep your original until you have checked the result.
Read the privacy details →Made for the work in front of you.Report a problem ↗