Guides Favs 0

Home / Developer / JS Formatter & Minifier

JS Formatter & Minifier

Beautify JavaScript with consistent indentation, or minify it with Terser.

Real tools, in your browser: formatting uses js-beautify and minification uses Terser — the same minifier behind most production build tools — so the output is safe to ship. Modern syntax (ES2022+, classes, async, optional chaining) is supported. Syntax errors are reported with their line and column.

About the JS Formatter & Minifier

The JavaScript Formatter and Minifier beautifies JS with consistent indentation, or minifies it with Terser — the same minifier many build tools use — optionally shortening variable names for the smallest possible output. It is useful for reading minified scripts, cleaning up snippets and shrinking code for production.

How to use the JS Formatter & Minifier

  1. Paste your JavaScript.
  2. Choose the indent size.
  3. Click Format to beautify, or Minify to compress — tick “Shorten variable names” for maximum savings.
  4. Copy the result.

Frequently asked questions

What does minifying JavaScript do?

It removes whitespace and comments and can shorten local variable names, making the file smaller so it downloads and parses faster, while the code still behaves the same.

Is shortening variable names safe?

Terser only renames local variables that can’t be accessed from outside, so the code keeps working. Global names and object properties are left alone.

Can I turn minified code back into the original?

Formatting restores readable indentation, but shortened names and removed comments can’t be recovered — keep your original source.