Skip to main content
PulsarKit

Format, minify and validate XML

Indent XML so a human can read it, collapse it onto one line, or just check it; comments, CDATA and attribute order come out untouched.

Drop your files here

.xml, .rss, .svg, .xhtml, .txt · up to 100 MB

How to Format XML

  1. 1

    Drop your XML file

    Add one document or up to twenty at once. Each file is decoded, parsed and rewritten inside this browser tab.

  2. 2

    Pick format, minify or validate

    Format indents the tree by two spaces, four spaces or tabs. Minify collapses everything onto a single line. Validate only reports on the file and changes nothing.

  3. 3

    Download the rewritten file

    Save the result next to your original, or take a whole batch back as one ZIP archive.

Re-indentation, not a round trip

Loading XML into an object and writing it back out is the easy way to reindent a file, and it quietly discards everything that is not an element: comments, CDATA sections, processing instructions, attribute order. This tool walks the document and prints it again, so all of that comes back in place. Text and attribute values are kept exactly as they were written, which means an ' stays an ' rather than turning into an apostrophe behind your back.

What minify actually removes

The bytes in an indented file are whitespace-only text nodes sitting between tags, so those are what minify drops. Text with real content beside it is left alone. In a paragraph like a bold word wrapped mid-sentence, the spaces around the inner tag are part of the sentence, and losing them would change the document rather than shrink it.

Errors point at a place

A syntax error names the line, the column and the closing tag expected there, because a message without a position sends you back to scrolling. Custom entity declarations in a DOCTYPE are rejected rather than expanded, which is what keeps a billion-laughs file from freezing the tab.

The file never leaves your machine

Decoding, parsing, rewriting and packing the ZIP archive all happen inside this browser tab. Nothing is uploaded, there is no queue and no server-side copy left behind, so a configuration file carrying production hostnames or credentials is only ever read by your own computer, and it is gone the moment you close the tab.

Frequently asked questions

Are comments and CDATA sections kept?

Yes, both, in their original positions and with their text unchanged. So are processing instructions and the order attributes appear in. If you actively want the comments gone there is a separate switch for it, plus one for dropping the XML declaration line.

How is minify different from deleting the whitespace myself?

A search-and-replace across the file also strips the spaces inside text content and inside CDATA, which changes what the document says. Here only whitespace-only nodes between tags are removed, and elements holding real text keep their spacing exactly.

Why was my file rejected for declaring entities?

A DOCTYPE containing an ENTITY declaration is refused before parsing starts. Expanding entities is how the billion-laughs attack turns a few kilobytes into gigabytes of memory, and how external entities reach files they should not. Remove the DOCTYPE block and the rest of the document formats normally.

Can I check a file without downloading anything?

Validate mode does exactly that. It reports whether the document parses, how many elements it contains, how deep the tree goes and which encoding was used, and produces no file at all. Switch to format afterwards if you decide you want the tidied version.

Does it work with SVG, RSS and XHTML?

Yes. All three are XML, so an SVG icon, an RSS feed or an XHTML page is indented and minified by the same rules. An Office document with a .docx or .xlsx extension is a ZIP container rather than plain XML, and gets pointed at the right tool instead.

What is the size limit?

100 MB per file, up to twenty files in one batch. Large documents are slower mainly because the whole tree is held in memory with its comments and node order intact, which costs more than a flat object would.

Which encodings can it read?

The encoding is taken from the XML declaration at the top of the file. UTF-8, UTF-16, windows-1251, windows-1252 and ISO-8859-1 are supported, so a Cyrillic or Western European legacy file comes through with its characters intact.

Is my XML uploaded anywhere?

No. Everything runs locally in your browser, with no server involved and nothing retained once you close the tab.

Related tools