Back to All Tools

XML / YAML Formatter

Format, validate, and minify XML and YAML documents in your browser.

Runs entirely in your browser — nothing is uploaded

About the XML / YAML Formatter

The XML / YAML Formatter cleans up config files and data documents that arrive as one unreadable line or with broken indentation. Paste an XML document or a YAML file, pick the matching mode, and get back consistently indented output you can read and diff. It covers the three jobs you keep needing here: reformatting for readability, shrinking for transport, and checking that the syntax parses.

Pick the XML or YAML button at the top, which also loads a small sample. Beautify re-indents XML with two spaces and collapses whitespace-only content; for YAML it re-dumps the parsed tree at two-space indent with a 100-character line width. Minify strips XML line breaks and indentation entirely, and packs YAML onto minimal lines. Validate reports whether XML is well-formed or YAML is valid.

It is free, needs no account, and every parse and format runs in your browser. Nothing you paste is uploaded, so you can run internal Kubernetes manifests, CI pipeline files, or SOAP payloads through it without leaking anything. Because it treats XML and YAML as separate modes rather than guessing, you get formatting rules that fit each format instead of one generic pretty-printer.

How to use the XML / YAML Formatter

  1. 1Click the XML or YAML button to match the format you are working with.
  2. 2Replace the loaded sample in the Input box with your own document.
  3. 3Click Beautify to re-indent the document into readable form.
  4. 4Click Minify instead to strip indentation and line breaks into compact output.
  5. 5Click Validate to check that the document parses, and read any syntax error.
  6. 6Click Copy under the Result, or Clear to empty both boxes.

What you can use it for

Read a minified API response

A REST or SOAP endpoint returns XML as one long line with no breaks. Paste it, stay in XML mode, and Beautify to see the tag hierarchy on separate indented lines and find the element you need.

Fix a broken CI file

Your pipeline fails because a YAML file has a bad indent or a stray tab. Switch to YAML mode and click Validate to get the parser's error message, then reformat with Beautify once it parses cleanly.

Shrink config for transport

You need to embed an XML fragment in a script or environment variable where line breaks cause problems. Use Minify to remove all indentation and newlines, then Copy the single-line result.

Normalize before a diff

Two YAML files differ only in spacing and wrapping. Beautify both so they share the same two-space indent and line width, and the remaining diff shows real value changes instead of formatting noise.

Well-formed versus valid, and why the difference matters

When you click Validate in XML mode, the tool parses your document and reports it well-formed if that succeeds. Well-formed is a narrow claim: every opening tag has a matching close, attributes are quoted, elements nest without overlapping, and there is a single root. That is enough for a parser to build a tree, and it breaks most often when you hand-edit XML.

Well-formed is not the same as valid in the formal sense. A validating check compares the document against a DTD or XSD schema defining which elements are allowed and in what order. This tool applies no schema, so a document can pass here yet be rejected by a stricter consumer.

Frequently asked questions

Does my XML or YAML get uploaded anywhere?

No. The formatting, minifying, and validation all run in your browser. Your document never leaves your machine, so pasting internal configs or manifests does not send them to any server. You can even disconnect from the network and the tool still works.

Does Validate check my XML against a schema?

No. Validate only checks that the XML is well-formed, meaning tags are properly nested and closed. It does not verify the document against a DTD, XSD, or any schema, so it will not flag a missing required element or wrong data type. For YAML, it confirms the document parses.

What is the difference between Beautify and Minify?

Beautify adds two-space indentation to make the structure readable. Minify removes it: XML collapses to one line with no breaks, and YAML packs onto minimal lines. Both produce the same data, formatted for reading versus for compactness.

Why does it load sample text when I open it?

Each mode starts with a short example so you see the format the tool expects and can try the buttons right away. Switching between XML and YAML replaces the input with that mode's sample and clears the result. Just paste your own document over the sample.

Will YAML output keep my comments and key order?

No. The tool parses your YAML into a data structure and re-dumps it, so anchors, comments, and non-standard ordering are not preserved. The output reflects the parsed object. If you rely on comments inside a YAML file, keep your original, since the output holds only the data itself.