JSON Formatter & XML Prettifier
Prettify and validate JSON and XML documents.
How the Text & Code Formatter works
JSON is parsed with the browser’s standards-compliant parser and re-serialised with your chosen indentation, so the output is guaranteed to be valid JSON. XML is parsed into a DOM, checked for well-formedness and re-indented node by node.
When parsing fails, the tool reports the line and column of the problem so you can jump straight to the missing comma, quote or closing tag. Everything runs locally and no data leaves your device.
How to use the Text & Code Formatter in 3 steps
Step 1
Paste or type your JSON or XML into the input editor and choose the format.
Step 2
Select an indentation size, then format or minify the document.
Step 3
Fix any error shown at the reported line and column, then copy the result.
Frequently asked questions
Is it safe to paste sensitive JSON into this formatter?
Yes. Formatting happens entirely in your browser with JavaScript; the content is never sent to a server or stored.
Why does my JSON fail to validate?
The most common causes are trailing commas, single quotes instead of double quotes, unquoted keys and comments, none of which are allowed by the JSON standard.
Can I minify JSON as well as prettify it?
Yes. Choose minify to strip all whitespace for smaller payloads, or format to make it readable again.
Related tools
- Regex Tester & ExplainerTest regular expressions against sample text with live match highlighting and a token-by-token explanation.
- Base64 & URL EncoderEncode and decode text to and from Base64 or URL-safe percent-encoding.
- UUID & Password GeneratorGenerate v4 UUIDs and strong, customizable random passwords using your browser’s secure random source.