Code Formatter
Tidy up minified or badly indented code. Fourteen languages, with control over indentation, quote style and line width.
Java, Python, C, C++, C#, PHP, Swift, Kotlin, Objective-C and Protobuf are not listed. Their formatters are native programs with no browser build, so supporting them would mean uploading your code to a server — which this site does not do.
How to use it
- Choose the language, or load the example to see the shape.
- Paste your code into the input pane.
- Pick an indent — two spaces, four, or tabs.
- Select Format, then copy or download the result.
Questions
Which languages are supported? JSON, JavaScript, TypeScript, JSX, CSS, SCSS, LESS, HTML, Vue, YAML, Markdown, GraphQL, SQL and XML. Each language’s formatter is loaded only when you actually use it, so the page stays quick to open.
Why are Java, Python and C++ not listed? Their formatters — google-java-format, Black, clang-format — are native programs with no browser build. Supporting them would mean sending your code to a server to be processed, which is exactly what this site does not do. We would rather leave a language out than quietly break the promise the rest of the site makes.
Which formatter does it use? Prettier for JavaScript, TypeScript, CSS, SCSS, LESS, HTML, Vue, YAML, Markdown and GraphQL; sql-formatter for SQL. JSON and XML are handled directly. The output matches what Prettier would produce locally, so it will not fight your project’s own setup.
Can it minify? JSON, yes — the Minify button strips all whitespace. For other languages, minification is a build-tool job rather than a formatting one.
Why keep the input and output separate? So a bad result costs nothing. A formatter that rewrites your text in place loses the original, and there is no undo across a reformat.