About JavaScript Formatter
A minified bundle, a snippet copied from the console and a hastily edited script all look the same: long lines, inconsistent quotes and no clear block structure. This formatter parses the code with the Babel parser used by Prettier and prints it with consistent indentation, quotes and line breaks, so functions, objects and expressions are readable again.
Minify starts from the parsed and formatted code, then removes comments and redundant whitespace and tightens punctuation while keeping strings, template literals and regular expressions exactly as written. Both modes report syntax errors with a line and column, and both run entirely in the browser. JavaScript and JSX are supported; TypeScript is not.
What this tool does
Babel parser for real JavaScript
Formatting uses Prettier's Babel parser, which understands modern syntax, JSX, template literals and regular expressions rather than guessing at tokens.
Two- or four-space indent
Pick the indentation the project uses and see it applied consistently to blocks, objects, arrays and chained calls.
Comment-aware minify
Minify removes comments and redundant whitespace while copying strings, template literals and regular expressions exactly, so URLs and patterns survive.
Syntax errors with position
When the code does not parse, the parser message is shown with its line and column, which is usually enough to spot a missing bracket or quote.
Copy and download
Copy the formatted or minified code or download it as a .js file, ready to paste into an editor, a bookmarklet or a build step.
Private and local
Parsing, printing and minification run in the browser tab; the code never leaves the device and no request is made.
How to use JavaScript Formatter
- 01
Paste or load JavaScript
Paste the code into the input pane or load a .js, .mjs, .cjs or .jsx file from your device, up to 10 MB.
- 02
Choose the indentation
Select two spaces or four spaces for the formatted output; minify ignores indentation and returns a compact one-line result.
- 03
Format or minify
Press Format to pretty-print the code or Minify to remove comments and whitespace. The code is parsed first, so a syntax error stops the action with a position.
- 04
Review the output
Read the formatted or minified code and check that strings, template literals and regular expressions came through unchanged.
- 05
Copy or download
Copy the code to the clipboard or download it as a .js file, then use it in your project as usual.
Supported formats and limits
- Input
- JavaScript
- Output
- JavaScript
- Processing
- Client-side, in your browser. Nothing is uploaded.
- Maximum size
- Bound by the memory available to your browser tab.
- Requirements
- Chrome, Edge, Firefox or Safari · JavaScript enabled
Limitations worth knowing
- JavaScript and JSX only: TypeScript syntax and .d.ts files are not supported.
- Minify removes comments, including licence headers; keep the original when those must ship.
- Minify does not rename variables or perform dead-code elimination, so it is a whitespace/comment minifier rather than a bundler-grade optimiser.
- Input is capped at 10 MB and formatting runs on the main thread after a short yield.
Privacy and file handling
Your code is read, parsed and printed entirely inside this browser tab with Prettier loaded as a page script. The source is never uploaded to FormatFlow or anyone else, no copy is stored and nothing leaves your device; closing the page clears the input and the result.
Read the full privacy policy
