Choose the parser first
Select JS, JSX, TS or TSX before pasting a mixed syntax snippet. TypeScript generics and JSX angle brackets need the appropriate parser.
- The example button loads a valid snippet for the current mode.
HTML / CSS Dev Tools
Choose the syntax and style, then inspect the result beside the original.
Your code stays in this browser tab; this tool does not upload it.
Paste code or load an example.
A JavaScript formatter helps when a pasted snippet has become hard to review or a TypeScript example uses a different house style. Keep the original on the left while the formatted result appears on the right.
This JavaScript formatter parses code before printing it, so template strings, JSX and type annotations are handled as syntax rather than by replacing spaces. It reports the first parse error instead of guessing a repair. A JavaScript beautifier is useful for quick review, but this Prettier online view still follows only the options shown here.
A parser and explicit modes make the output easier to trust.
Switch among JS, JSX, TS and TSX before formatting. A TSX component keeps its type annotations and JSX structure; it is never silently treated as executable JavaScript.
Change indentation, quotes, semicolons, line width or trailing commas, then compare against the untouched input. The JavaScript formatter marks an old result stale until it has been recalculated.
Select JS, JSX, TS or TSX before pasting a mixed syntax snippet. TypeScript generics and JSX angle brackets need the appropriate parser.
Auto formatting starts after a 350 ms pause and reruns when a style option changes. Turn it off to make formatting explicit.
Copy and download unlock only when the result matches the current input and options. A parse error points to its first line and column.
Format ordinary JavaScript, JSX markup, TypeScript annotations and TSX components using the matching Prettier parser.
Set two or four spaces, tabs, quote preference, semicolons, line width and trailing comma policy without altering the source panel.
Check syntax separately, or minify plain JavaScript with Terser. The minified output is downloadable as a .min.js file.
Choose TypeScript or TSX for typed code and JSX for JSX without types. The JavaScript formatter uses the selected parser; it never removes TS types or compiles JSX.
You can control indentation, tabs, single or double quotes, semicolons, line width and trailing commas. These apply to formatting, not to the separate JS minifier.
No. Terser accepts plain JavaScript here. Transpile TS, TSX or JSX in your project first, then paste the resulting JS in JavaScript mode.
The selected parser found invalid or incomplete syntax. Check the shown line and column, and confirm that the syntax mode matches the snippet.
The snippet is processed in your browser tab. It is not uploaded by this tool or placed into the URL.
Not answered?
Return to the editor with your chosen syntax mode. The original remains separate from the result, so you can review every change before copying it.
Processed locally in your browser.