curl to Code Converter
Turn a curl command into working fetch, axios, Python, PHP, Go or Ruby.
Pretty-print XML with clean indentation, or collapse it back to one line.
The XML Formatter re-indents a document so its structure is visible: one element per line, children under their parent, text-only elements left on a single line, and CDATA, comments and the declaration preserved exactly.
Machine-written XML arrives as one enormous line. The formatter re-indents it so the structure is visible: one element per line, children indented under their parent, and attributes left on the opening tag where they belong.
A few decisions make the output genuinely readable rather than merely indented. An element holding nothing but text stays on one line, because splitting it would change the content of a whitespace-significant document. Empty elements collapse to the self-closing form. CDATA sections, comments and processing instructions are preserved exactly, and the XML declaration is kept at the top. If the document does not parse you get the line number and what was expected instead.
A tag wrapping nothing but text is not split, because breaking it would change the content of a whitespace-significant document.
CDATA sections, comments and processing instructions are copied through untouched, and the declaration stays on the first line.
An element with no content is written in the self-closing form, which is shorter and unambiguous.
A document that will not parse reports the line and names the mismatched, unclosed or stray tag.
Prefixed names such as soap:Envelope and xmlns attributes pass through formatting unchanged.
A config file, an API response, an RSS feed or a SOAP envelope.
Two spaces, four spaces or a tab, to match the rest of your project.
An unparseable document reports the line and the mismatched or unclosed tag.
Take the formatted document to your clipboard or save it as .xml.
Only whitespace between elements. Text inside an element is preserved, attributes keep their values, and CDATA is copied through untouched.
Almost always a mismatched or unclosed tag, or more than one root element. XML is far stricter than HTML: every tag must close, and nesting must be exact.
Yes by default, and there is an option to strip them when you want the smallest readable document.
Yes. Prefixed element names such as soap:Envelope and xmlns attributes are treated as ordinary names and attributes, so they survive formatting unchanged.
What people who use the XML Formatter think of it. Reviews come from visitors and are posted as written.
No ratings yet
Yours would be the first.
0 reviews
Newest first
No reviews yet
Be the first to rate the XML Formatter. It takes half a minute and no account.
Write the first reviewTurn a curl command into working fetch, axios, Python, PHP, Go or Ruby.
Break an emoji into its code points, modifiers and joiners.
Score a selector and find out which of two rules actually wins.
Convert XML into clean JSON, with attributes and text handled predictably.
Normalise YAML indentation, quoting and key order in one pass.
Validate an IBAN's length, country and mod-97 checksum, and generate test ones.
Encode and decode quoted-printable, the MIME encoding in every email header.
Generate prefixed API keys in the format modern providers use.