Format Function Declaration
Input
function test(a,b){return a+b;}Example output
function test(a, b) {
return a + b;
}
Format messy JavaScript into clean, readable code with configurable indentation and semicolon style, or minify code locally without sending scripts to external servers.
| Formatter Engine | Prettier Babel parser in an isolated Web Worker |
|---|---|
| Supported Operations | Beautify (format) and Minify |
| Privacy & Security | 100% Client-side execution; code is never uploaded |
| Maximum Input | 5 MB |
Input
function test(a,b){return a+b;}Example output
function test(a, b) {
return a + b;
}
Input
// Calculates sum
function add(x, y) {
/* Return sum */
return x + y;
}
Example output
function add(x, y) {
return x + y;
}When semicolons are disabled in options, Prettier only omits semicolons where safe under ECMAScript ASI rules, preventing syntax errors in return or destructuring statements.
Modern ES2024+ syntax including async generators, private class fields, optional chaining, and nullish coalescing operators format reliably.
Standard JavaScript with ES module syntax is supported. For specialized JSX or strict TypeScript type annotations, use the dedicated JSX Formatter and TypeScript Formatter tools.
HTML Formatter
Format, beautify, and minify HTML markup locally in your browser.
CSS Formatter
Format, beautify, and minify CSS stylesheets locally in your browser.
Code Snapshot
Render pasted code as a styled SVG snapshot with syntax highlighting, themes, window frames, and gradient backgrounds for blogs and docs.
No. All parsing and formatting takes place entirely in your browser using an isolated Web Worker.
The formatter supports ECMAScript 2024 and modern stage 3/4 proposals including private fields, decorators, and pattern matching syntax.
Yes. Use the Semicolons option toggle to choose between StandardJS-style semicolon-free code or standard semicolon-terminated statements.