Code beautifier
Format messy or minified code in Python, Java, C, C++, C#, Go, PHP, JavaScript, TypeScript, Lua and Shell, plus SQL, HTML, CSS, JSON and YAML. Each language uses its own standard formatter.
Loading…
How it works
- 1
Paste your code
The language is detected automatically; pick it from the list if the guess is wrong.
- 2
Set the style
“Default” follows each language’s convention (4 spaces for Python and Java, tabs for Go); or choose 2 spaces, 4 spaces or tabs, and the line width.
- 3
Copy or download
The formatted code updates as you type. Syntax errors are reported instead of breaking your code.
Questions
- Which formatters are used?
- The standard one for each language: Ruff (Black-compatible) for Python, clang-format for C, C++, Java and C#, gofmt for Go, Mago for PHP, StyLua for Lua, shfmt for shell scripts and Prettier for JavaScript, TypeScript, HTML, CSS, JSON, YAML and Markdown.
- Is it the same as running the formatter locally?
- Yes. These are the real formatters compiled to WebAssembly, so the output matches what you get on your machine with the same settings.
- What about Rust, Kotlin, Swift or Ruby?
- Their formatters can’t run in a browser yet. They’ll be added as browser builds become available.
- Is my code uploaded?
- No. Formatting happens in this tab, so it’s safe for private and proprietary code.