About this tool
A JavaScript formatter rewrites valid JavaScript or TypeScript with consistent style. It uses Prettier to expand minified code, indent nested blocks, wrap long expressions, and normalize quote and semicolon choices. Use it for a hard-to-read snippet, generated bundle section, typed module, or source that came from a project with different formatting rules.
Your JavaScript or TypeScript runs through the formatter locally in the browser, is never uploaded, and disappears when the tab closes. Select the matching language, then set quotes, semicolons, indentation, and print width. TypeScript mode understands type annotations and other TS syntax that the JavaScript parser would reject.
How to use the JavaScript Formatter
- 1Paste JavaScript or TypeScript source into the code editor.
- 2Select TypeScript when the input contains types or TS-only syntax.
- 3Choose quote style, semicolon behavior, indentation, and print width.
- 4Run Prettier to expand and consistently format the source.
- 5Review the rewritten code before copying it into your project.
Features
JavaScript TypeScript modes
Choose the proper parser for plain JavaScript or source containing TypeScript types.
Quote style setting
Prefer single or double quotes where Prettier can safely apply that choice.
Semicolon preference
Keep or omit statement semicolons according to the selected formatting option.
Readable bundle expansion
Add structured whitespace and wrapping to valid minified JS or TS input.
Script width guidance
Set indentation and print width together for a layout suited to your editor.
Frequently asked questions
Can the JavaScript formatter process TypeScript?
Yes. Switch the language to TypeScript so type annotations, interfaces, and other supported TS syntax are parsed correctly.
Will formatting minified JavaScript restore original variable names?
No. It can restore readable whitespace and line breaks, but it cannot recover names or comments removed during minification.
Why did Prettier change more lines than I expected?
Prettier prints the parsed program using its own consistent rules. A small input edit can therefore change wrapping across a larger expression.
Can I choose both double quotes and no semicolons?
Yes. Set the quote option to double and disable semicolons, then format the source with those preferences.
Is proprietary JavaScript uploaded anywhere?
No. Formatting is performed in the browser, and the code is not kept once you close the tab.