JavaScript Beautifier
Format messy or minified JavaScript into clean, readable code. Powered by Prettier, so the output matches what your editor would produce.
100% free. Runs entirely in your browser - your files and data never leave your device and nothing is uploaded to any server.
edit_noteInput
outputOutput
About this tool
Format messy, minified or inconsistently indented JavaScript into clean readable code. This uses Prettier - the same formatter most editors and CI pipelines run - so the output matches what your team's tooling would produce.
How to use this tool
- Paste JavaScript snippetDrop any messy, minified, or inconsistent JS into the input area.
- Run beautifyApply Prettier formatting with consistent indentation and spacing.
- Review parse errorsIf formatting fails, fix reported syntax errors first, then rerun.
- Copy formatted outputUse cleaned code in commits, reviews, or debugging sessions.
How to read minified JavaScript
Paste the minified script and beautify it to restore line breaks and indentation. Variable names that were shortened to a, b and c cannot be recovered - minification throws the original names away - so follow the strings, property names and function calls to understand what the code does.
If the site publishes source maps (a .map file next to the script), the browser’s developer tools can show the original source instead.
Key features
- Produces stable formatting aligned with common team tooling.
- Great for reading compressed or poorly formatted scripts.
- Improves code review readability and maintainability.
- Runs locally in browser for quick, privacy-friendly formatting.
Common uses
- Cleaning pasted snippets before code reviews.
- Inspecting one-line minified bundles during debugging.
- Standardizing style before sharing code examples.
- Learning unfamiliar JavaScript by making structure readable.
Tips for better results
- Format early while debugging to reduce cognitive load.
- Fix syntax errors before expecting formatter output.
- Use project formatter settings in CI for repository consistency.
- Pair beautify with linting for both style and correctness checks.
Mistakes to avoid
- Expecting beautifier to repair broken JavaScript logic.
- Assuming formatted code implies semantic correctness.
- Manually reformatting large files instead of automated tooling.
- Ignoring parser error locations and guessing fixes.
Frequently asked questions
Yes, it runs Prettier's standalone build directly in your browser. The output is identical to what you would get from a local Prettier install with the same settings, so it will not fight your project's formatting.
No. Prettier only reprints the code from its parsed syntax tree - it never rewrites logic. If your code has a syntax error the tool reports the exact line and column instead of guessing, because formatting broken code would produce misleading output.
It handles modern JavaScript and JSX. Minified single-line files reformat perfectly - that is one of the most common uses. For heavy TypeScript-specific syntax, results may vary since the parser here targets JavaScript.
No. Everything runs in your browser, so proprietary or unreleased code never leaves your machine. The tool also works offline once the page has loaded.
Paste it here to restore line breaks and indentation, then search for the function or string you care about. Variable names stay short because the originals are not in the file.
Indent width, quote style and line width. Matching your project's settings means pasted code will not show up as a wall of changes in the next diff.
Prettier needs code that parses. A missing bracket, an unclosed string or a stray character stops it; the error message points to the line. Fix that and format again.