XML Formatter & Validator

Format, validate, and minify XML documents.

What XML Formatter & Validator helps you do

Format, check and minify XML documents. It indents minified XML so it is readable, checks for well-formedness, and can compress it back for transfer. The formatter uses two-space indentation, and validation only confirms that the document parses as XML.

XML processing runs in your browser. Your documents are not uploaded to Haivix.

How it works

These tools transform text locally: they parse, format, encode or render a string in your browser. Nothing you paste is uploaded to Haivix, but some tools load a library from a public CDN, so the page needs a network connection and your browser makes that request. The transformations operate on syntax, not meaning: a formatter can make invalid code look tidy, an encoder can hide a value without protecting it, and a preview can render markup that was never meant to execute. Outputs are exact strings, which means line endings, byte order marks and character encoding all matter when you paste the result somewhere else.

How to use XML Formatter & Validator

  1. Paste the XML into the input.
  2. Format it to indent, validate to check for errors, or minify to compress.
  3. Read the status message for well-formedness.
  4. Copy or download the result.

When to use it

  • Make a minified XML config or SOAP response readable.
  • Check whether an XML file is well formed before using it.
  • Reduce XML size for transfer or storage.
  • Inspect the nesting of a generated feed.
  • Compare the structure of two XML fragments after formatting.
  • Prepare a readable sample for a bug report.

When not to use it

  • Do not use it to validate against an XSD or DTD schema.
  • Do not rely on it to preserve mixed content precisely; it is a text formatter.
  • Do not format a document with large embedded CDATA and expect unchanged bytes.

Example

A single-line XML document is formatted into an indented tree that mirrors its nesting. Elements that contain only text stay on one line, while child elements get their own lines. An unclosed tag produces an error and no formatted output. Minifying collapses the whitespace between tags but does not remove comments.

What you can do with XML Formatter & Validator

  • Indent XML with two spaces per level.
  • Minify whitespace between tags.
  • Validate well-formedness before formatting.
  • Copy the result or download it as a file.
  • Report the parser error for invalid input.
  • Keep the document in the browser.

Example: test with a real sample before trusting the output

Keep the original text. These tools produce a new value rather than editing in place, so a bad transform is reversible only if you still have the source.

Test with a representative sample, including the awkward case: a quote inside a string, a tag inside an attribute, a newline in the middle of a value.

Check line endings and encoding when moving between Windows, Unix and a browser form. A trailing carriage return can break a signature or a hash.

Treat pasted HTML and Markdown as untrusted. A preview that renders raw markup can execute event handlers even when it looks harmless.

Verify the result with the real parser, compiler or linter before shipping. A browser-side formatter is a convenience, not a substitute for the toolchain.

Prefer exact values over screenshots or copied rendered text. Rendering can normalize quotes, dashes and spaces in ways that break the next tool in the chain.

What to know before you start

  • Validation checks well-formedness, not conformance to a specific XSD schema.
  • XML that references an external DTD is parsed without fetching it, so some validation is not performed.
  • The formatter is regex-based and may not preserve mixed content exactly.
  • It does not resolve namespaces or check business rules.

Common mistakes

  • Treating a well-formedness pass as schema validation.
  • Formatting XML with significant whitespace in mixed content.
  • Assuming comments and processing instructions are normalized.
  • Pasting HTML into an XML validator and expecting it to pass.

Troubleshooting

If validation fails, check for an unclosed tag, a mismatched name or an unescaped ampersand.

If the output looks wrong, the source may contain mixed content where indentation changes meaning.

If formatting refuses to run, the document did not parse.

If a namespace prefix is undeclared, the parser may reject the document.

If the file is large, formatting may take a moment before the output appears.

Related standards and documentation

  • ECMA-404 defines JSON, and RFC 8259 defines its media type.
  • XML 1.0 is a W3C Recommendation; schemas are defined separately by XSD.
  • ECMA-262 defines JavaScript, including its regular expression syntax.
  • RFC 3986 defines URI syntax and percent-encoding.
  • CommonMark specifies Markdown, though many renderers extend it.
  • The HTML Living Standard defines character references and parsing rules.
  • Unicode defines the character encodings behind text and entity handling.
Syntax, not semantics
  • Keep the source.
  • Test the awkward case.
  • Check encoding and newlines.
  • Verify with the real tool.