Using the XML Formatter
The XML Formatter indents an XML document you paste. The box starts as <a><b>Hi</b></a>. Choose Format XML. The label above the headline reads XML. The headline is Formatted XML. The result is a declaration on the first line, then the element a on its own line, then the element b indented by two spaces with the text Hi still inside it, then the closing a on its own line. The declaration reads <?xml version="1.0"?>. The character line is 42. The text Hi is still between the b tags. The page did not rewrite Hi as something else, and it did not drop the element names.
The formatter reads the XML you pasted. It does not fetch a file, and it does not follow a link inside the document. A document type is rejected before formatting, so an external entity is not read. The message is Remove the document type before formatting. Malformed XML, such as a tag that never closes or a document that is not XML, says Enter well-formed XML. An empty box, or a paste longer than 20000 characters, says Enter from 1 to 20000 characters. The page counts those characters on the text you submitted. It does not format a rejected paste, and the character line is not a formatted length until the run succeeds.
The sample stays small on purpose. <a><b>Hi</b></a> has a root element a and a child element b. After formatting, each of those elements has its own line, b is indented, and Hi remains the text of b. The character line 42 counts the formatted document, including the declaration and the line breaks, not the shorter line you pasted. Copy result copies that formatted document. You can paste it elsewhere as text. The page does not save a file for you.
Reset returns the box to <a><b>Hi</b></a> and the headline to Paste XML. Format again and the indented document returns, still containing Hi, with the character line at 42. The same paste builds the same indentation. Change the text inside b and the formatted document keeps the new text in that same indented place, as long as the XML is well formed and has no document type. If the paste fails, the headline is the message, and there is no indented document to copy.
Read the formatted lines before you treat them as a file you already stored. The page only shows the indentation. It does not upload the document, and it does not check that a server would accept it. The checks it does make are the length, the document type, and whether the XML is well formed. Hi in the sample is the sign that the text nodes were kept. If Hi were missing, the result would not be this formatter showing the sample.
What the Indented Sample Contains
The formatted sample begins with the declaration <?xml version="1.0"?>. The next line is the opening of a. The line after that is b, indented two spaces, with Hi as its text and the closing b on that same line. The last line closes a. The headline does not repeat the document. It reads Formatted XML. The character line reads 42, which is the length of that indented document. The original paste was the single line <a><b>Hi</b></a>. Formatting added the declaration, the line breaks, and the indent. It did not add a second copy of Hi, and it did not rename a or b.
The text node is the part to check. Hi is still the characters between the opening b and the closing b. Element names stay as pasted. The page is indenting structure, not translating words. If you replace Hi with another short word and the document is still well formed, that word appears in the indented b element. The character line then changes because the formatted document changed. For the starting paste, the line stays 42.
How the Sample Is Indented
The page checks the length first. The paste must contain from 1 to 20000 characters. It then rejects a document type. The sample has none, so that check passes. It parses the remaining text as XML. <a><b>Hi</b></a> parses. The formatter then writes the document with each element on its own indented line and keeps the text that was already inside the elements. That write includes the declaration <?xml version="1.0"?>. The steps under the result say those moves: read the XML without a document type, place each element on its own indented line, and keep the text that was already inside the elements. The character line counts the written document.
Compact JSON is a different grammar and a different direction. The JSON Minifier removes insignificant space from a JSON value. {"a": 1} becomes {"a":1}. The page parses the text first, so a broken value is rejected instead of being trimmed by hand. It does not fetch a URL. Use it when you want a shorter JSON value. Use this page when you want XML expanded onto indented lines. The minifier will not indent <a><b>Hi</b></a>, and this formatter will not turn {"a": 1} into {"a":1}.
What Formatting Does Not Fetch
The box is the whole input. A file path, a web address, or a note that says where the XML lives is not opened. If those characters are inside the paste, they are XML text or they make the document malformed. They are not a request. The page does not read an external entity, and a document type is the case it refuses by name: Remove the document type before formatting. Take that declaration out of the paste and format the remaining document if the remaining document is well formed.
Formatting also does not add a schema, a namespace you did not type, or a comment. It does not sort attributes into a new order you chose, and it does not validate the document against a business rule. Well formed means the tags parse. It does not mean the element names match a spec you have in mind. Hi is kept because it was the text of b, not because the page knows what Hi should say. After you copy the result, any later edit is yours. The page does not watch the copy.
Formatting <a><b>Hi</b></a>
Leave the box as <a><b>Hi</b></a>. Choose Format XML. The headline is Formatted XML. The character line is 42. The document shows the declaration <?xml version="1.0"?>, then a, then an indented b that still contains Hi, then the closing a. Format again. The character line is 42 again, and Hi is still there. Copy result copies that document. Clear the box and format. The headline reads Enter from 1 to 20000 characters. Restore the sample and format. The indented document returns with Hi inside b.
A token with a header and a payload is a different paste and is not indented as XML. The JWT Decoder decodes the header and the payload of a JSON Web Token. The page does not check the signature, so a decoded payload is not proof that the token is genuine. A token needs two dots and three parts. A token whose payload is {"sub":"1234567890"} shows that JSON, and the signature is still not verified. Use that page when the paste is a token. Use this page when the paste is XML. A token is not well-formed XML, and <a><b>Hi</b></a> is not a token with two dots.
Length, Document Type, and Well-Formed XML
The paste must be from 1 to 20000 characters. Empty text and longer text both say Enter from 1 to 20000 characters. A document type anywhere in the paste says Remove the document type before formatting, even when the rest of the tags would have parsed. Malformed XML says Enter well-formed XML. That includes a missing close tag, a stray character where an element was required, and text that is not XML at all. The page does not return a half-indented document along with the message. The headline is the message, and there is no character line for a formatted result.
The character line on a success is the length after indentation, not the length of the paste. The sample paste is shorter than 42. The formatted document is 42 characters because of the declaration, the line breaks, and the two spaces before b. A larger well-formed document can grow the same way when line breaks and indents are added. If that growth is what you need to store, copy the result and count from the copy. The page shows the formatted length in the character line so you do not have to count the sample by hand.
Pastes the Formatter Will Not Rescue
A common miss is to leave a document type in the paste and expect the formatter to skip it. The page stops with Remove the document type before formatting. Delete that part and format again. Another miss is to paste a fragment that is not well formed and expect Hi, or some other word, to be indented anyway. The message is Enter well-formed XML, and no indented lines are returned. Another miss is to paste a path and expect the page to open it. The page does not fetch a file. Another miss is to read the character line 42 as the length of <a><b>Hi</b></a> before formatting. 42 is the formatted document.
A grid rule is a different kind of generated text. The CSS Grid Generator builds a grid container with equal columns. 3 columns and a gap of 16 becomes repeat(3, 1fr) and gap 16px. Every column is 1fr. The page does not write a stylesheet file. Use it when you want that CSS. Use this page when you want XML indented. The grid text is not XML, and the formatted sample is not a grid. Hi stays inside b only on this formatter.
The Sample, a Document Type, and a Broken Tag
Format the starting paste and read the declaration, the line for a, the indented line for b, and the closing line for a. Confirm Hi is on the b line and the character line is 42. Copy the document, then reset. The box returns to <a><b>Hi</b></a> and the headline returns to Paste XML. Format once more and confirm 42 and Hi again. Change the text Hi to OK and format. The indented b element now contains OK, and the character line changes because the text changed. Restore Hi and confirm the character line is 42 again.
Keeping the Formatted Document
Copy result copies the indented document, including the declaration and Hi. The character line 42 is on the page next to that document for the sample, but the copy is the document itself. A note that says only Formatted XML does not preserve the indentation or the text Hi. Paste the copy into the note if you need the lines. The page does not store the run. Reset clears the result back to Paste XML and restores the sample in the box, which is the unformatted line, not the indented document. Copy before you reset.
A robots file is a different text and a different set of fields. The Robots TXT Generator builds a robots.txt file from a user agent, a disallow path, an optional allow path, and an optional sitemap URL. The page does not upload the file. Use it when you want those robots lines. Use this page when you want XML indented. A robots file is not the formatted sample, and the formatted sample is not a robots file. Hi is not a user agent.
Indented XML With the Text Still There
The result answers what the paste looks like after each element is placed on its own indented line. For <a><b>Hi</b></a> the answer includes the declaration <?xml version="1.0"?>, the element a, the indented element b still containing Hi, and a character line of 42. A document type is not formatted. Malformed XML is not formatted. A paste outside 1 to 20000 characters is not formatted. The page does not fetch a file to fill in anything you left out.
Checking Hi and the Character Line
Format the sample and look for Hi inside b. Then read the character line. It should be 42. Read the first line of the document. It should be the declaration <?xml version="1.0"?>. If the headline is Enter from 1 to 20000 characters, the box is empty or too long. If the headline is Remove the document type before formatting, delete the document type. If the headline is Enter well-formed XML, fix the tags. A successful headline reads Formatted XML. Copy result after that success copies the indented document, not the error.
Language tags are a different check and do not indent XML. The Hreflang Validator checks hreflang tags you type, one per line. en is valid. en-US is valid. english is not. The page does not fetch a site. Use it when the lines are language tags. Use this page when the paste is XML and you want it indented. A tag such as en is not the sample document, and Hi is not an hreflang tag.