Skip to content
epitometool

JS / TS formatter

Code formatters

Format JavaScript and TypeScript with Prettier rules.

Updated

JavaScript input

Layout tool, not a parser — use Prettier or esbuild for production formatting / minification.

Options

Output

function greet(name) {
  if(!name) {
    return "Hello, world!";
  }
  const greeting=`Hello, ${name}!`;
  console.log(greeting);
  return greeting;
}
greet("Alice");
greet();

Quick start

How to quickly format JavaScript in the browser

Paste a minified or messy snippet, get readable output. For production formatting use Prettier.

  1. Step 1
    Paste JavaScript

    Drop a minified bundle, a one-liner or a snippet you want to inspect.

  2. Step 2
    Pretty or minify

    Pretty mode adds line breaks and indents by brace depth. Minify strips comments and whitespace.

  3. Step 3
    Copy result

    One-click copy. For production work always re-run Prettier / esbuild in your editor.

In-depth guide

JavaScript formatter — quick browser-side cleanup

Paste minified or messy JavaScript and get back something readable. A lightweight brace-depth layout tool — not a full parser. Useful for inspecting a snippet from a CDN, a one-liner from Stack Overflow, or a build artefact when Prettier isn't handy.

What this is — and isn't

This tool tokenises by tracking braces, parens, strings and comments. It adds newlines after { } ; and indents by depth. That's it.

Use it for: quickly reading a minified bundle, cleaning up a snippet you found, pre-formatting before pasting into your editor.

Don't use it for: production code formatting (use Prettier), serious minification (use esbuild / terser), TypeScript layout (use ts-format / Prettier), or anything safety-critical.

Minify mode

Strips comments, collapses runs of whitespace, and removes space between non-identifier characters. Typical savings on already-formatted code: 30-50%. For production-grade minification (variable renaming, dead-code elimination, tree-shaking) you need a real bundler like esbuild or swc.

Known limits

  • Regex vs divisiona / b / c vs /foo/.test(x) is ambiguous without semantic analysis. We treat / as division; regex inside a single line may get malformed by minification.
  • ASI — automatic semicolon insertion isn't applied. Code that relies on it (a line ending with ++ followed by () may behave differently after minification.
  • JSX / TS — type annotations and JSX pass through but layout is imperfect.
  • One-liners with ; chained may format slightly off compared to Prettier.

Frequently asked questions

Does this tool send my JavaScript anywhere?

No. Formatting runs entirely in your browser.

Is this a replacement for Prettier?

No — be honest about what this is. It's a brace-depth-tracking layout tool, not an AST-based formatter. It handles obvious cases but won't make perfect decisions about ternary chains, JSX or complex generic syntax. Use Prettier in your real codebase.

Why not just bundle Prettier?

Prettier ships ~3 MB of standalone bundle including its parser plugins. That defeats the point of a tiny in-browser tool. For quick-and-dirty cleanup of a snippet, this is faster to load.

Does minify actually save space?

Modestly — it strips comments and runs of whitespace. For production minification (variable renaming, dead-code elimination, tree-shaking) use esbuild, terser or swc. Output here may sometimes break for edge cases involving regex or template literal expressions.

What about TypeScript or JSX?

Type annotations and JSX largely pass through because our tokenizer skips strings and comments. Layout may be imperfect — Prettier with the TS / React plugin remains the right tool.

How are strings and regex preserved?

We detect string boundaries (', ", `) and skip whitespace collapsing inside them. Regex literals aren't fully detected — adjacent / in division vs regex is ambiguous without a real parser.

Keep exploring

More tools you'll like

Hand-picked utilities that pair well with the one you're on — all free, client-side, and zero-signup.