JavaScript Formatter & Minifier
Beautify JavaScript and TypeScript, or minify JavaScript with Terser.
How to use JavaScript Formatter & Minifier
- Paste JavaScript or open a file.
- Choose Format to make it readable, or Minify to make it small.
- Copy or download the result. Syntax errors are reported with their line.
How it works
Format uses Prettier, the de facto standard formatter: it parses the code and reprints it with consistent indentation, spacing and line breaks, without changing behaviour. It also makes minified code readable again, although shortened variable names cannot be restored. JSX is understood, and TypeScript can be formatted by choosing it under "Code is".
Minify uses Terser, the minifier behind most modern build tools. It removes whitespace and comments, optionally simplifies the code (dead-code removal, constant folding) and shortens local variable and function names. Names that could be used from outside (top-level names in a script, properties) are left alone, so the code keeps working.
Everything runs in your browser. The text you paste is not uploaded, logged or saved, so configuration files, API responses and customer data stay on your device. The code is parsed, never executed.
Example
function sumEven(numbers){let total=0;…} formats to a readable twelve-line function; minified with name shortening it becomes a single line about 40% smaller.
Frequently asked questions
Is minified JavaScript safe?
Yes, with the defaults. Terser only makes changes that keep behaviour identical. Test after minifying if your code depends on function names (for example via Function.name) or uses eval.
Can I un-minify code?
Format restores indentation and line breaks. Original variable names and comments are gone for good unless you have a source map.
Does my code get uploaded?
No. Both tools run in your browser, which matters for proprietary code and anything containing keys.
Does it support modern syntax?
Yes: current ECMAScript including classes, async/await, optional chaining and modules. Choose "JavaScript module" when the code uses import or export.
Can it minify TypeScript?
No. Compile TypeScript to JavaScript first; it can be formatted here.
Limitations
- No source maps are produced.
- TypeScript is format-only.
- It does not bundle files or resolve imports.
- The first use downloads the formatter or minifier (about 1 MB).
Last reviewed November 9, 2026. How we build and test tools.