XML Formatter
Indent compact XML while keeping mixed content, existing whitespace and entity spelling intact.
- Free
- Works Offline
- No Uploads
How to Format XML
- Open the HTML, review Security Check, then select Continue.
- Paste XML 1.0, open a UTF-8 .xml file, or choose Open Sample.
- Select two spaces, four spaces or tabs, then choose Format XML. Existing whitespace, mixed content and protected xml:space regions stay as supplied.
- 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
| Input | Paste XML 1.0 or choose a local UTF-8 .xml file up to 2 MiB. Select two spaces, four spaces or tabs. |
|---|---|
| Output | Review the plain-text result and the listed protected regions. Copy or download the complete UTF-8 XML file. |
| Browser | A modern browser with local file support. |
| Scope | Format 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 |
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.