Micru Logo

JS Formatter

Paste messy or minified JavaScript and get clean, consistently indented code. Choose your preferred indentation style.

All processing is done locally in your browser. No data is sent to our servers.

How JavaScript Formatting Works

This formatter parses your JavaScript into an abstract syntax tree (AST) using Babel, then regenerates it with consistent indentation, spacing, and line breaks. It handles all modern JavaScript syntax including ES modules, arrow functions, destructuring, optional chaining, and nullish coalescing.

Because the formatter works at the AST level rather than using regex, it produces correct output even for complex or edge-case code structures.

Formatting Options

2 Spaces

The most common convention in JavaScript projects and the default for many linters.

4 Spaces

Preferred in some teams for deeper visual nesting distinction. Common in Node.js codebases.

1 Space

Compact formatting when you want structure but minimal indentation width.

Tab

Lets each developer control indentation width in their editor. Used in some open-source projects.

Supported Syntax

Modern JavaScript

Arrow functions, async/await, destructuring, template literals, optional chaining, and nullish coalescing.

JSX & TypeScript

Full support for JSX syntax and TypeScript-specific constructs like type annotations and interfaces.

ES Modules

Properly formats import/export statements including dynamic imports and re-exports.

Class Syntax

Classes with public/private fields, decorators, getters/setters, and static members.