Loading...
Loading...
Format and beautify JavaScript, TypeScript, HTML, CSS, JSON, Markdown, YAML, and more with Prettier. Customizable rules and instant formatting.
Press Ctrl + Enter to format
Copy your messy or unformatted code and paste it into the input editor.
Choose the appropriate parser (JavaScript, TypeScript, HTML, CSS, JSON, etc.).
Adjust formatting options like tab width, quotes, semicolons, and trailing commas.
Click 'Format Code' to beautify, then copy or download the formatted result.
Format JavaScript, TypeScript, HTML, CSS, JSON, Markdown, YAML, GraphQL, SCSS, and Less with full Prettier support.
Fine-tune formatting with options for tab width, quotes, semicolons, trailing commas, and bracket spacing.
See your original code and formatted output simultaneously in a clean, split-pane editor interface.
Format thousands of lines of code in milliseconds with Prettier's blazing-fast parsing engine.
Transform minified, unreadable code into beautifully formatted, human-readable code with proper indentation and spacing.
Test and validate team coding style guides before committing code. Ensure consistency across your entire codebase.
Properly formatted code makes debugging significantly easier by improving readability and revealing structural issues.
See how Prettier formats code to learn industry-standard formatting conventions and best practices.
Quickly format code snippets for documentation, blog posts, Stack Overflow answers, or tutorials.
Adjust formatter settings to match your project's specific style guide and formatting preferences.
Code formatting is essential for maintaining readable, consistent, and professional codebases. This tool uses Prettier, the industry-standard code formatter trusted by millions of developers worldwide.
All formatting happens in your browser. Your code never leaves your device, ensuring complete privacy and security.
Uses Prettier, the industry-standard code formatter with opinionated, battle-tested formatting rules.
Format even large files instantly with no server round-trips or API rate limits.
Once loaded, the formatter works completely offline. No internet connection required.
No registration, no limits, no hidden costs. Format unlimited code anytime, anywhere.
Get production-ready, consistently formatted code that meets professional standards.
Number of spaces per indentation level. 2 spaces is Prettier's default and most common in JavaScript. 4 spaces is common in Python and older codebases.
Indent with tabs instead of spaces. Tabs are more accessible (users can set their preferred width) but spaces are more common in web development.
Add semicolons at the end of statements. JavaScript doesn't require them (ASI), but many style guides mandate them for safety and clarity.
Use single quotes instead of double quotes for strings. Single quotes are popular in JavaScript; double quotes are default for JSON.
Add trailing commas where valid in ES5 (objects, arrays) or all (including functions). Produces cleaner git diffs when adding new elements.
Print spaces between brackets in object literals. { foo: bar } vs {foo: bar}. Spacing is more readable; no spacing is more compact.
Enable 'Auto Format on Paste' to automatically beautify code as soon as you paste it. Saves time and clicks.
Configure settings to match your project's .prettierrc file. Common combos: 2-space tabs + single quotes for JavaScript, 4-space for Python-style.
Set trailing commas to 'all' or 'es5' to produce cleaner git diffs when adding new array/object elements.
Prettier is opinionated by design. Trust its defaultsβthey're based on years of community feedback and real-world usage.