JSON Formatter
Pretty-print and validate JSON, with the exact line and column of any error.
Indent and validate XML documents.
XML Formatter indents an XML document so its structure is visible, and tells you plainly when the document will not parse. Both halves matter: XML is strict, and a single unclosed tag or stray ampersand makes the whole file unusable to anything that reads it.
Parsing uses the browser's own XML parser, which means the validation is the real thing rather than an approximation. When a document fails, you get the parser's own message naming the line and the problem, which is normally enough to find it immediately.
The formatter handles the parts of XML that trip simpler tools: namespace prefixes are preserved, CDATA sections are passed through exactly, comments and processing instructions stay where they were, and attribute values are left untouched. A minify mode collapses the document back to one line when you need it compact.
The xml formatter is used by writers, developers, students, marketers and anyone else who needs the job done once without installing software. Common cases include:
Usually an unclosed tag, a stray ampersand that should be &, mismatched case in a tag name, or more than one root element. XML is case-sensitive and has exactly one root, both of which catch people used to HTML.
No. XML is strict: every tag must close, attribute values must be quoted, and there is one root element. HTML browsers are forgiving of all three, which is why markup that renders fine fails as XML.
Yes, exactly as written. Their whole purpose is to hold content that must not be parsed, so a formatter that indented inside them would corrupt the data.
No. It checks that the document is well-formed, which is the structural question. Validating against a DTD or XSD is a separate step that needs the schema itself.
Documents of a few megabytes format fine. Very large ones may be slow, since the whole document is parsed into memory in the tab.
No. Parsing and formatting happen in your browser.
If the xml formatter is not quite what you need, these other free tools solve closely related problems.
Pretty-print and validate JSON, with the exact line and column of any error.
Build sitemap.xml from your URL list, with lastmod, changefreq and priority.
Pretty-print HTML with consistent indentation, or collapse it back down.
Translate between YAML and JSON, with clear errors on invalid indentation.
View CSV data as a proper table you can sort, search and page through.