---
title: XML Formatter & Validator Online — Pretty Print & Minify
url: https://varstatt.com/toolkit/xml
description: Format, validate and minify XML. Errors show line and column. Pick 2 spaces, 4 or tabs.
section: Developer Toolkit (https://varstatt.com/toolkit)
tags: data
related: JSON (https://varstatt.com/toolkit/json), YAML (https://varstatt.com/toolkit/yaml), XML (https://varstatt.com/toolkit/xml), JSON ↔ YAML (https://varstatt.com/toolkit/json-yaml)
---
# XML Formatter & Validator

Format, validate and minify XML. Errors show line and column. Pick 2 spaces, 4 or tabs.

## How It Works

1. **Paste your XML** — Paste a document, a sitemap, an RSS feed, a SOAP message or an SVG. It is checked as you type.
2. **Check the result** — A valid document shows its element, attribute and depth counts. An invalid one shows the error with its line and column.
3. **Format or minify** — Format re-indents the document with 2 spaces, 4 spaces or tabs. Minify strips the whitespace between tags. Then copy.

## FAQ

### What does the validator check?

That the document is well-formed: one root element, every tag closed and nested in order, quoted attributes, and valid characters. It does not check a schema (XSD) or a DTD.

### Does formatting change my data?

Only whitespace between tags. Text, attributes, comments, CDATA sections and the XML declaration are kept as written. In an element that mixes text and child tags, the text moves to its own line.

### Why does the error point to a different line than the mistake?

A parser reports where it noticed the problem, which is often after the real mistake. An unclosed tag, for example, is only noticed when the next closing tag does not match. Look at the line before.

### Can it format SVG, RSS or sitemaps?

Yes. They are all XML. For a sitemap, the [sitemap validator](https://varstatt.com/toolkit/sitemap) also checks the URLs and limits.

### Is my XML uploaded?

No. Parsing and formatting run in your browser with the built-in XML parser. Nothing is sent to a server.

## Usage

This tool runs entirely in the browser — visit the URL above to use it.

Prefill inputs via URL parameters:

- `https://varstatt.com/toolkit/xml?input=...`

## Related Tools

- [JSON](https://varstatt.com/toolkit/json)
- [YAML](https://varstatt.com/toolkit/yaml)
- [XML](https://varstatt.com/toolkit/xml)
- [JSON ↔ YAML](https://varstatt.com/toolkit/json-yaml)
