Code Formatter
Format, minify and validate JSON, XML, HTML, CSS, JavaScript, SQL and YAML.
Result
YAML is parsed and written back out, so comments are dropped and some values may gain quotes or be rewritten (e.g. 010 → 10) without changing their meaning.
Your data is processed entirely in your browser and is never sent to a server.
How to use Code Formatter
- Paste your code into the Input box — the tool detects the format (JSON, XML, SQL…) and formats it right away.
- If it guessed wrong, pick the format from the bar above and click Format.
- Choose 2 or 4 spaces or a tab for indentation; JSON and YAML can sort keys, SQL lets you pick a dialect.
- Click Minify (JSON, XML) to put everything on one line, or Copy to grab the result.
Frequently asked questions
Is my data sent to a server?
No. Everything runs in your browser, so it is safe to format JSON that contains tokens, config files or internal data.
Why does it say my JSON is invalid?
JSON requires double quotes around keys and strings, and does not allow trailing commas or comments. The error message includes the position so you can fix it quickly.
Does formatting YAML keep comments?
No. YAML is parsed and written back out, so comments are dropped and some values may gain quotes, but the meaning stays the same.
Which SQL dialects are supported?
Standard SQL, MySQL/MariaDB, PostgreSQL, SQLite and SQL Server (T-SQL). Pick the right dialect to correctly format syntax such as PostgreSQL $1 parameters.