How to use
- Pick the tool that matches your kind of code from the sets above. It opens right below, and the part after
#in the address changes so you can share the same view. - Paste the code you want to format or check. Each tool starts with an example so you see a result right away.
- Copy the result or download it as a file. To work in one tool alone, press “Open this tool on its own page”. Every tool also has its own page.
Which tool to choose
| What you want to do | Tool |
|---|---|
| Expand JSON that arrived on one line, or find where it breaks | JSON formatter |
| Indent XML such as a sitemap, RSS feed or config file | XML formatter |
| Add line breaks and indentation to a cramped SQL query | SQL formatter |
| Read JSON or XML from a Kafka or SQS message that is escaped or wrapped in Base64 | Message payload formatter |
| Beautify HTML, or strip whitespace and comments to shrink it | HTML beautify and minify |
| Beautify or minify CSS | CSS beautify and minify |
| Read minified JavaScript, or shrink your code | JavaScript beautify and minify |
| Find unclosed tags, duplicate ids and basic accessibility problems | HTML validator |
| Find XML syntax errors, or validate structure against an XSD schema | XML validator |
| Catch SQL slips such as unbalanced quotes or brackets, stray commas, or UPDATE without WHERE | SQL syntax checker |
| Catch PHP slips such as unbalanced brackets or possible missing semicolons | PHP syntax checker |
Beautify, minify and check: what is the difference?
- Beautify (pretty print): adds line breaks and indentation so people can read the code. It does not change what the code does.
- Minify: removes whitespace, line breaks and comments to shrink the size. Use it when sending or shipping code; it becomes harder to read. The minifiers in this set do not rename variables to shorter names.
- Check (validate, lint): reports the line and column of a problem without changing your code. Passing does not guarantee the code will run. The checkers here look for visible slips such as unclosed brackets or tags; the final verdict belongs to a real parser such as a browser, a database or
php -l.
The most common reasons JSON fails
JSON looks like a JavaScript object but its rules are stricter. At the line and column the JSON formatter reports, look for these first.
| Cause | Wrong | Fixed |
|---|---|---|
| A comma after the last item | {"a":1,} |
{"a":1} |
| Single quotes | {'a':1} |
{"a":1} |
| Keys without quotes | {a:1} |
{"a":1} |
| Comments | {"a":1} // note |
Remove the comment |
undefined or NaN |
{"a":undefined} |
Use null or a number |
For example {"name":"김민지","tags":["vip","new"]} is 41 bytes on one line (UTF-8) and becomes 7 lines when indented with two spaces. Formatting only changes the shape, so the data stays the same.
Frequently asked questions
Does formatting change how the code behaves?
No. Beautifying only changes line breaks and indentation. Places where whitespace matters, such as inside HTML <pre> and <textarea>, are safest left alone, and the HTML tool in this set does not touch them.
Can I turn minified code back into readable code?
Line breaks and indentation come back, but removed comments do not. If variable names were shortened to a and b (obfuscation), beautifying cannot restore the names. Keep the original source.
The last digits of a long numeric ID in my JSON changed
JavaScript numbers are exact only up to 9,007,199,254,740,991 (2 to the power 53, minus 1). A value like 12345678901234567890 can change its last digits the moment it is parsed, so large IDs are safer as strings. If you must keep a 19-digit message queue ID as is, use the message payload formatter.
The syntax check passed but the code fails when I run it
A checker finds problems visible in the text alone, such as quotes, brackets and tag pairs. Missing tables or columns, type mismatches, permissions and function arguments only show up when the code really runs. Do the final check in the real environment.
Is my code sent to a server or executed?
No. The tools in this set only analyze what you paste as text. They do not run it, send it anywhere or store it, so table names in a query or personal data in a response never leave your browser.
Where do I handle YAML?
This set covers JSON, XML, SQL, HTML, CSS, JavaScript and PHP. To convert between JSON and YAML use JSON and YAML converter, and to see the difference between two JSON documents use JSON diff.
Related tools
To turn JSON into TypeScript types use JSON to TypeScript, to draft an XSD for your XML use the XSD generator, and to compare before and after use text diff. A .env file can be converted to other formats with the .env converter.
The code you enter is processed only in your browser and never sent to a server.