FormatIn browser

JavaScript formatter

A JavaScript formatter/minifier for snippets, code fragments and client-side bundle drafts: Prettier formatting, Terser minify and useful syntax errors without running code.

Use cases
JavaScript snippetsCode reviewBundle draftsMinification
Input JavaScript
characters: 0lines: 0
Result

How it works

The JavaScript formatter lazy-loads Prettier standalone with Babel/ESTree parser plugins for formatting and Terser for minification. Both steps work with the AST locally in your browser and do not execute user code.

When to use it

Formatting helps read snippets, debug copied code and prepare fragments for review. Minification is useful when you need a compact version of a small browser-side script or test payload.

How to use it

  1. 1Paste JavaScript into the editor.
  2. 2Click Format for readable indentation or Minify for compact output.
  3. 3If the parser cannot read the code, fix the issue shown in the result area.
  4. 4Copy the result or clear the fields.

Questions

Is JavaScript sent to a server?

No. Formatting and minification run in your browser, so source code stays on your device.

Does the tool execute pasted code?

No. The code is only parsed and printed back or minified. The tool does not use eval, Function or script execution.

Which libraries are used?

Formatting uses Prettier standalone with Babel/ESTree plugins, and minification uses Terser. Both libraries have permissive OSS licenses and load only on this tool page.

Other tools

All tools