XML Formatter & Converter

Tools ViewerXML Formatter logo

XML Formatter & Converter

Use it for SOAP envelopes, WSDL snippets, config files, feeds, and API payloads. Validation checks well-formed XML (parser errors), not XSD/DTD schemas. Converters are best-effort for nested documents. For JSON workflows use JSON Formatter & Converter; for HTML markup use HTML Viewer Pro.

Price
Free
Account
Not required
Runs in
Your browser
Drafts
Stay local

How to use it

Paste or import XML, then format, validate, or convert.

  1. Paste, open a file, or import a URL

    Drop in XML, open a local file, or use Import URL for public http(s) endpoints that allow CORS.

  2. Format, minify, or validate

    Pretty-print with your indent, compress whitespace, or validate and review parser errors. Check the size tab for pretty vs minified bytes.

  3. XPath, namespaces, convert, or compare

    Run XPath expressions, audit namespace prefixes, export to JSON or other formats, compare two XML documents, or browse the tree outline. Then copy or download the result.

Common use cases

Debug SOAP/WSDL, convert formats, and tidy payloads without an IDE.

  • Convert XML to JSON and more

    Use the XML to JSON converter for API payloads, or export CSV, TSV, YAML, and plain text when you need how to convert XML to CSV or an XML to txt dump — plus conversion JSON XML the other way via JSON Formatter.

  • Format and validate

    Pretty-print messy XML, run an XML syntax check for invalid XML characters and ampersands, and minify when you need a compact payload.

  • XPath and namespaces

    Test XPath against SOAP or config XML, filter nodes, and verify namespace prefixes and URIs before integration.

  • Privacy while you work

    Formatting, validation, XPath, and conversion run in your browser. Import from URL fetches directly from your device to that host. See the Privacy Policy.

Features in the workspace

Pretty-print and minify, validate XML, strip comments, sort attributes, escape / unescape entities, Base64 and URL helpers, XPath tester, namespace inventory, convert XML to JSON and other formats, compare documents, browse a tree outline, import from URL, and download the result — a private XML workspace without installing an IDE or signing up.

  • XML formatter / pretty print / validator
  • XML minify and one-line output
  • XML to JSON / JSON-LD / CSV / TSV / YAML conversion
  • Export TypeScript, C#, Java, JS, Python, and Lua helpers
  • XPath tester for node and scalar queries
  • Namespace inventory for prefix/URI auditing
  • SOAP and WSDL sample presets
  • Escape / unescape XML entities
  • Base64 encode / decode for XML payloads
  • URL encode / decode utilities
  • Strip XML comments
  • Sort XML attributes
  • XML tree view output
  • Side-by-side XML compare with diff view
  • Private browser-only processing

Related apps live on the Tools Viewer homepage — including JSON Formatter & Converter and HTML Viewer Pro.

Related tools

Guides & articles

Frequently asked questions

What is an XML formatter?

An XML formatter reorganizes XML with clean indentation so the structure is easier to read and debug. ToolsViewer’s XML Formatter & Converter also validates XML, minifies output, converts from XML into multiple formats, and provides XPath and namespace tools.

Is this XML formatter free?

Yes. XML Formatter & Converter on Tools Viewer is free to use with no signup.

Does it validate XML and show errors?

Yes. Invalid XML returns parser errors, including line hints when your browser parser provides them.

Can I convert XML to JSON, YAML, CSV, and TSV?

Yes. Convert mode is an XML to JSON converter (and more): export from XML to JSON, JSON-LD, YAML, CSV, TSV, plain text / XML to txt, escaped strings, and code-helper formats such as TypeScript, C#, Java, JS, Python, and Lua. For JSON → XML, use JSON Formatter’s converter JSON XML path.

Can I check invalid XML characters and ampersands?

Yes. The validator surfaces well-formedness errors — including issues that often involve XML ampersands, quotes, and other illegal or disallowed characters — with line hints when the browser parser provides them.

Can I compare two XML files?

Yes. Compare mode is an XML file comparison tool: paste A and B, then review structural differences in the tree diff.

Can I run XPath queries?

Yes. The XPath tester evaluates expressions against your XML and returns matching node or scalar results directly in the tool.

Can I inspect XML namespaces?

Yes. The namespace inventory collects declared namespace prefixes and URIs so you can verify SOAP/WSDL and other namespaced documents quickly.

Does it support SOAP and WSDL samples?

Yes. Sample presets include SOAP envelopes and WSDL snippets to test formatting, XPath expressions, and namespace handling.

Does it validate against XSD or DTD schemas?

No. It checks that XML is well-formed and surfaces parser errors. It does not run XSD or DTD schema validation.

Can I strip comments and sort attributes?

Yes. Utility actions include stripping XML comments and sorting attributes alphabetically on each element.

Does it include escape/unescape, base64, and URL encoding tools?

Yes. The utility panel includes XML entity escape/unescape plus Base64 and URL encode/decode helpers.

Is my XML uploaded to a server?

Formatting, validation, XPath tests, and conversion run in your browser. Your XML stays on your device unless you choose to export it. Import from URL fetches that host directly from your browser when CORS allows it.

Can I compare two XML documents?

Yes. Compare mode shows two documents side by side with a diff view so you can review structural differences after formatting or transformation.