Compress JavaScript for production or format it for readability — pure JS engine, zero dependencies, 100% in-browser.
JavaScript minification removes comments, whitespace, and newlines while safely collapsing operators. Careful handling of string literals, regex literals, and template literals ensures that content inside quotes is never altered — only the structural whitespace between tokens is removed.
Beautification reconstructs readable code from minified or poorly indented JavaScript. A token-aware brace-depth parser tracks
{
,
}
,
(
,
)
, and statement boundaries to rebuild correct indentation — handling function declarations, arrow functions, object literals, arrays, and template literals.
The most critical part of any JS minifier is correctly identifying and preserving string literals (
"..."
,
'...'
), template literals (
`...`
), and regex literals (
/.../
) so their content is never modified. This implementation uses a character-by-character tokenizer to extract and protect all literals before any transformation.