JS フォーマッター

JavaScript の整形・圧縮

Indent:

Input

Loading editor...

Output

Loading editor...

Beautify or minify JavaScript without firing up a build

Production JavaScript is minified, mangled, and impossible to read by hand. Formatting turns it back into readable code with proper line breaks and indentation, while minifying compresses hand-written code for lightweight embedding. Both run in the browser without any setup.

Use the formatter when you need to

Read a minified production bundle

Expand a chunk pulled from devtools so you can locate the function or expression that's misbehaving.

Clean up a script before review

Apply consistent indentation and line breaks before sharing a snippet in a doc or PR.

Minify a small snippet for embedding

Compress a script before pasting it into an HTML template, email, or single-line config.

How to format JavaScript quickly

  1. 1

    Paste minified or hand-written JavaScript.

  2. 2

    Pick indentation style and width.

  3. 3

    Click Format to beautify or Minify to compress, then copy the result.

Common JS-formatting workflows

Investigate a bundled error

Format the relevant chunk so you can locate the source of an error in production output.

Audit a third-party script

Expand a minified vendor file to confirm what runs on your page before integrating.

Compress an inline snippet

Minify a small script for inclusion in HTML, JSON, or a single-line config string.

関連ツール

よくある質問

Paste JavaScript and click Format. The tool indents blocks, breaks long lines, and applies your chosen indentation style. It runs entirely in your browser using a JavaScript-aware parser.

Yes for minified code — formatting reverses whitespace removal so you can read the source. For obfuscated code where variable names are mangled, formatting helps with structure but cannot recover the original names.

The formatter is JavaScript-focused. TypeScript syntax (type annotations, interfaces, generics) is mostly handled, but specialized TS-only features may not format perfectly. For TypeScript projects, use Prettier or your IDE's formatter.

Yes. Click Minify to remove whitespace, comments, and line breaks. The minified output is byte-equivalent for execution but may be larger than what a full minifier (Terser, esbuild) produces, since this tool doesn't rename variables.

No. Formatting only changes whitespace, which has no effect on JavaScript execution. The formatted code runs identically to the original — only readability changes.