Local StudioDEVELOPER TOOLS

XML Formatter

Indent compact XML while keeping mixed content, existing whitespace and entity spelling intact.

  • Free
  • Works Offline
  • No Uploads
Works with:
  • Microsoft Edge
  • Google Chrome
  • Mozilla Firefox
  • Safari
XML Formatter showing formatted XML and identifying the mixed-content and xml:space sections left untouched.
The sample indents the catalog and leaves the price text and the code block intact.

How to Format XML

  1. Open the HTML, review Security Check, then select Continue.
  2. Paste XML 1.0, open a UTF-8 .xml file, or choose Open Sample.
  3. Select two spaces, four spaces or tabs, then choose Format XML. Existing whitespace, mixed content and protected xml:space regions stay as supplied.
  4. Review the formatted XML and source regions left untouched. Choose Copy XML or Download XML. Download preserves file bytes.

Indent XML While Preserving Text

  • Choose two spaces, four spaces or tabs.
  • See examples of protected regions with their source lines.
  • Keep literal text, entity spelling and XML declarations.

Formats and Compatibility

InputPaste XML 1.0 or choose a local UTF-8 .xml file up to 2 MiB. Select two spaces, four spaces or tabs.
OutputReview the plain-text result and the listed protected regions. Copy or download the complete UTF-8 XML file.
BrowserA modern browser with local file support.
ScopeFormat one UTF-8 XML 1.0 document up to 2 MiB. The formatter keeps existing text and spaces, and inserts indentation only between adjacent child tags in eligible sections.
Operating Systems
  • Windows
  • macOS
  • Linux
  • ChromeOS

Local Processing Without Uploads

Format XML without uploading files. This browser-based tool has no upload and works offline.

Select Open Sample to see the workflow with the included example.

XML 1.0 and Significant Whitespace

The formatter adds indentation between compact child tags where no text or other markup intervenes. It keeps mixed content, CDATA, existing whitespace, entity spelling, XML declarations and protected xml:space regions.

Review the Formatted XML

The sample indents the outer catalog while keeping the price text and the code block with xml:space. Indentation introduces whitespace nodes between eligible child tags. Existing source stays intact.

Frequently Asked Questions

How can I format XML offline?

Use the Format XML download, extract the ZIP, and open XMLFormatter.html. The free Format XML tool includes a sample.

Can I format XML in browser?

Use the local Format XML workbench to format a document on your device.

Can I format XML online?

Open the hosted Format XML browser tool. Processing stays on your device.

Why might an XML section stay unchanged?

If a section already contains text, whitespace, CDATA, interleaved markup or a protected xml:space value, the formatter keeps that section and its descendants as supplied. Some documents already have spacing throughout.

Which XML input is supported?

Use one namespace-aware UTF-8 XML 1.0 document. DTDs, custom entity declarations and external directives such as stylesheet associations and XInclude are outside the offline profile.

Does it preserve my file encoding and entity spelling?

The output is UTF-8. The formatter retains the original XML declaration, markup, predefined entity spellings and numeric references. Use Download XML for byte-precise file output.

Does this tool work offline on Windows, macOS, Linux, and ChromeOS?

Yes. Local Studio tools run offline on Windows, macOS, Linux, and ChromeOS. Download the tool ZIP, extract it, and open the included HTML file in a supported browser. Your files are processed on your device without uploads.

Which browsers can I use with this offline tool?

Use a current version of Google Chrome, Microsoft Edge, Mozilla Firefox, or Safari where that browser is available for your operating system. Chrome is built into ChromeOS, and Safari is available on macOS.