XML Formatter Guide — Format & Convert Online

Published on August 9, 2026 by Tools Viewer

Best for : Cleaning API and config XML, validating SOAP/WSDL samples, exporting to JSON or tabular formats, testing XPath expressions, and spotting structural diffs between two XML documents.
Not for: Full XSD schema validation, XSLT transforms, or server-side pipelines at scale. Converters and code helpers are best-effort for common shapes.

1. Overview

XML Formatter & Converter is a free browser tool for reading, editing, validating, comparing, and converting XML. Paste markup, pretty-print or minify, run XPath, inspect namespaces, convert to JSON / CSV / TSV / YAML / string, compare two documents, browse a tree outline, then download the result. Core work runs on your device.

XML Formatter & Converter workspace overview
XML Formatter overview — editor, format / convert / compare modes

2. All features

Everything below is available in the same workspace — use the mode toggle (Format / Convert / Compare) and toolbar actions.

  • 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

Prefer JSON workflows? Open JSON Formatter & Converter .

3. Workspace layout

The interface focuses on a few key parts:

  • Modes — Format, Convert, or Compare.
  • Editor — paste or edit input (XML A in Compare).
  • Output / XML B / Tree / Diff / XPath / Namespaces / Size — result tabs for text, outline, compare report, queries, and stats.
  • Actions — Format/Convert/Compare, Minify, Validate, utilities, Download.
XML Formatter & Converter workspace overview
Workspace layout — paste XML, choose mode, run actions

4. Format, minify & validate

Use Format to pretty-print well-formed XML with your chosen indent. Use Minify for compact one-line output. Validate confirms the document parses and surfaces parser errors with line hints when available.

Pretty-printed XML after using Format in the XML formatter
Format — pretty-print XML and catch parser errors

5. Converters (JSON, CSV, TSV, YAML, string & code)

Open Convert, keep From as XML, pick a To format, then run Convert. Built-in converters include:

  • XML to JSON — structured object from the element tree.
  • XML to JSON-LD — context-friendly object export.
  • XML to CSV / TSV — tabular rows for spreadsheet-friendly shapes.
  • XML to YAML — indented YAML document.
  • XML to String — escaped string literal.

Extra outputs: TypeScript, C#, Java, JS, Python, and Lua helpers, plus reformatted XML and plain text. Longer walkthrough: convert XML to JSON and XML to YAML / CSV .

XML converter with JSON CSV TSV YAML and string outputs
Convert — XML to JSON, CSV, TSV, YAML, string, and more

6. XPath & namespaces

Open the XPath tab, enter an expression (for example //item/@sku or count(//customer/*)), and run it against your XML. Results appear as serialized nodes or scalar values.

The Namespaces tab lists declared prefixes and URIs with occurrence counts — useful for SOAP envelopes, WSDL, and namespaced config. Load SOAP or WSDL samples from the Samples menu to try these panels quickly. See XML XPath tester and SOAP / WSDL XML formatter .

XPath tester panel evaluating an expression against XML
XPath — evaluate expressions and inspect matching nodes
Namespace inventory listing XML prefixes and URIs
Namespaces — prefix and URI inventory for SOAP/WSDL docs

7. Compare, tree & unique extras

Compare mode places XML A on the left and XML B on the right. Run Compare to open the Diff tab with a path-level report of structural differences.

Use the Tree tab for a collapsible outline. Utility actions include Strip comments, Sort attributes, Escape / Unescape, Base64, and URL encode / decode. See also compare XML online .

XML compare mode with structural diff report
Compare — structural differences between two XML documents
XML tree outline viewer in the results panel
Tree — collapsible outline of elements and attributes

8. Import URL & download

Import URL fetches a public http(s) XML or text resource from your browser. The remote host must allow CORS; private or blocked APIs will fail in the browser for security reasons. Tools Viewer does not proxy or store that content on our servers.

After formatting or converting, use Download to save a file locally (XML or the selected output extension such as .json, .csv, .tsv, .yml, .ts, or .cs).

Import XML from URL control in the XML formatter
Import URL — fetch a public resource from your browser (CORS required)

9. Size calculator

The size panel reports characters, UTF-8 bytes, pretty vs minified size, element depth, attribute counts, comments, and CDATA sections for the current document. Use it to see how much space Minify saves before you ship a payload.

XML size calculator panel with byte and minify stats
Size panel — characters, UTF-8 bytes, pretty vs minified

10. Privacy

Formatting, validation, XPath, conversion, compare, and tree browsing run in your browser. No signup is required. Import from URL contacts the remote host from your browser subject to CORS — that fetch is not proxied through Tools Viewer servers.