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
Format, inspect and minify in one editor, with the original and undo history available.
Format and Minify process the current content. Check Syntax only updates feedback. Changing syntax or style never rewrites code until you choose an action.
Ctrl/Cmd+Enter · Ctrl/Cmd+Z
Paste code or load an example.
0 UTF-16 units
Initial input: up to 1,000,000 UTF-16 units. Output and further processing of generated documents: up to 4,000,000 units. Your code stays in this browser tab; this tool does not upload it. Undo history stays in this tab and is bounded for large documents.
A JavaScript formatter helps when a pasted snippet is hard to review or uses a different house style. Format and edit JS, JSX, TS or TSX in one editor, view the retained original, and undo or redo changes.
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.
Keep working on the current code, with the original and undo history available at every step.
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.
The JavaScript formatter applies indentation, quotes, semicolons, line width and trailing commas only when you choose Format. Checking and changing options leave the current code intact; undo changes or restore the original when needed.
Select JS, JSX, TS or TSX before pasting a mixed syntax snippet. TypeScript generics and JSX angle brackets need the appropriate parser.
Format and Minify process the current content. Check Syntax only updates feedback. Changing syntax or style never rewrites code until you choose an action.
Review the current code, then copy or download it. Syntax errors include line and column details; use Undo or open the original to review earlier content.
Format ordinary JavaScript, JSX markup, TypeScript annotations and TSX components using the matching Prettier parser.
Indentation, quotes, semicolons, line width and trailing commas affect the next Format action. Minify uses separate Terser rules.
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?
Paste code, choose its syntax, then format and minify in one editor before exporting the current content.
Processed locally in your browser.