All-in-One Code Formatter (JSON, HTML, CSS, JS, SQL, XML)
Format and beautify JSON, HTML, CSS, JavaScript, TypeScript, SQL, XML, YAML, Markdown and GraphQL in one place, with auto-detect and minify.
Loading the tool…
Runs entirely in your browser. Your files and text are never uploaded to our server.
- Instant results
- 100% free
- No sign-up
- Private
Code Formatter cleans up messy code in one place. Paste JSON, HTML, CSS, JavaScript, TypeScript, SQL, XML, YAML, Markdown or GraphQL, and it detects the language and formats it with consistent indentation. You can also minify code to make it smaller.
More about All-in-One Code Formatter (JSON, HTML, CSS, JS, SQL, XML)How to use, good to know & FAQ
How to format code online
- Paste your code or open a code file. The language is detected automatically, or you can choose it.
- Pick the indent (2 spaces, 4 spaces or tab) and line width.
- Click Format / Beautify, or Minify to remove extra spaces.
- Click Copy or Download to save the result with the right file extension.
Supported languages
- Format: JSON, JavaScript, TypeScript, HTML, CSS, SCSS, LESS, XML, SQL, YAML, Markdown and GraphQL.
- Minify: JSON, JavaScript, CSS, HTML, XML and SQL.
- If the code has a syntax error, the tool tells you what went wrong and where, so it also works as a quick validator.
Need one language only? You can also use the JSON Formatter, HTML Formatter, XML Formatter, CSS Minifier or JavaScript Minifier.
Frequently asked questions
Is my code uploaded?
No. Formatting runs in your browser. Only the open-source formatter code (Prettier, sql-formatter and Terser) is downloaded the first time you use a language.
Does formatting change how my code works?
No. It only changes spacing, line breaks and, for some languages, quote style. Minifying removes comments and spaces but keeps the code working.
Why is my code detected as the wrong language?
Short snippets can look like more than one language. Choose the right one from the Language list and format again.
