Web & Developer Utilities100% Client-Side

XML Formatter and Prettifier

Paste a compact XML document or fragment to see its opening and closing tags on separate lines. The formatter shows each level of nesting with two or four spaces, making parent elements and siblings easier to distinguish. It is useful for inspecting feed entries, sitemap records, and configuration snippets. If your document mixes prose with markup or treats whitespace as data, compare the formatted result carefully before replacing the original.

Configuration Options

Number of spaces per XML tag indentation level.

Input
111 chars•1 lines
Output

Reverse tool

XML Minifier

Compact XML by stripping comments and whitespace between tags. Inspect the result before reusing it in a feed fixture, sitemap example, or test payload.

Open XML Minifier

How to Use the XML Formatter Online

  1. 1Paste the XML fragment you want to read. Include the enclosing element when its position matters, and keep the declaration if you are reviewing a full document.
  2. 2Set the indentation width to two or four spaces to match the surrounding source or the fixture you are preparing.
  3. 3Compare opening and closing tags at the same indentation level. Check which child elements are grouped under the same parent.
  4. 4Copy the result for review. If you intend to send it to a parser or an integration, check any elements whose content includes significant whitespace.

Input & Output Examples

The feed, item, and title become separate levels, and the item keeps its id attribute.

Input Sample
<feed><item id="7"><title>Release notes</title></item></feed>
Expected Output
<feed>
  <item id="7">
    <title>
      Release notes
    </title>
  </item>
</feed>

The declaration remains at the top. The self-closing cache element aligns with the following name element.

Input Sample
<?xml version="1.0"?><config><cache enabled="true"/><name>demo</name></config>
Expected Output
<?xml version="1.0"?>
<config>
  <cache enabled="true"/>
  <name>
    demo
  </name>
</config>

Practical Developer Workflows

  • Compare two feed entries by expanding their titles and other child elements before reviewing differences in the source.
  • Inspect the nesting of a sitemap record copied from a compact export without loading the full document into an editor.
  • Prepare a small XML fixture for a test or code review where a reader needs to see the hierarchy at a glance.

Zero Server Uploads & Complete Privacy

Runs 100% in your browser; no data is uploaded to any server.

Notice a bug, calculation error, or outdated info?

Let us know directly so our engineering team can fix it.

Frequently Asked Questions

The formatter estimates indentation from the tags it encounters. It can help you spot an unexpected level, but it does not check that every tag matches, verify namespace declarations, or validate against a schema. Use an XML parser for those checks.

Explore Other Tools

12 suggested tools

View all tools