Code Minifier & Beautifier
NewBeautify or minify JavaScript, TypeScript, JSON, CSS, SCSS and LESS.
Ctrl+Enterto beautify
Input (JavaScript)
0 characters
Output
Beautify runs Prettier in your browser. Minify strips comments and non-significant whitespace without renaming anything, so the result stays readable and safe to diff.
What is the Code Minifier & Beautifier?
This tool does both halves of code cleanup. Beautifying runs Prettier to apply consistent indentation, quotes and line width. Minifying strips comments and non-significant whitespace to shrink the file, while deliberately leaving identifiers alone so the output stays readable and diffable.
Frequently asked questions
Will minifying rename my variables like a bundler does?
No, and that is intentional. Mangling names needs full scope analysis to stay correct. This minifier only removes comments and whitespace, so it is safe to run on any file and the result still reads like your code. For maximum compression in a build, use a bundler.
Is it safe on code containing regex and template literals?
Yes. The minifier tokenises the source and tracks whether it is inside a string, template literal or regular expression, so a // or a brace inside those is treated as content rather than syntax. Newlines that carry meaning for automatic semicolon insertion are preserved.
Which languages are supported?
JavaScript, TypeScript, JSON, CSS, SCSS and LESS. JSON minifying reserialises through a real parser, so the output is canonical rather than whitespace-stripped guesswork.
Related Text & Code
- JSON FormatterFormat, validate and minify JSON documents.
- Text CompareDiff two blocks of text and highlight what changed.
- Case ConverterSwitch text between camel, snake, kebab, title and more.
- SQL FormatterPretty-print SQL queries with consistent keyword casing.
- Common Regex PatternsA searchable library of ready-to-use regular expressions.
- HTML BeautifierBeautify or minify HTML markup.
Code Minifier & Beautifier is one of 10 tools in Text & Code on Toolkit Hub, a free collection of browser-based utilities. It requires no account and no installation. Browse all tools.