ToolXkit Icon

XML Formatter

Format XML, see the error line, browse it as a tree, test an XPath.

  • Free
  • No signup
  • Nothing uploaded
  • No watermark

Input XML

Formatted XML

XPath runs against a parsed document — paste XML that is well formed and this box wakes up.

Parsed, checked and formatted on your device as you type. Nothing is uploaded.

How to Format and Validate XML Online

XML Formatter: before and after XML A BEFORE XML FORMATTER XML A AFTER

An XML file on one long line, from an API response, a sitemap or a payroll export, is almost impossible to read. Paste it into the left box and a neatly indented version appears on the right as you type.

The browser's own XML parser checks the document at the same time. If a tag is not closed or an ampersand is not escaped, you get the line and column of the problem in plain words. When it is well formed, you can browse it as a collapsible tree and test XPath queries against it.

No software to install Free Works on any device

Steps to Beautify Your XML

  1. 1. Paste the XML

    Put your document into 'Input XML'. The formatted version appears in 'Formatted XML' straight away.

  2. 2. Read the status line

    A green bar confirms well-formed XML with its element, attribute and depth counts. A red bar gives the line and column of the first error.

  3. 3. Choose the options

    Set the indent to 2 spaces, 4 spaces or a tab, keep or remove comments, sort attributes A to Z, or tick 'Minify instead'.

  4. 4. Explore and query

    Switch the output to Tree to fold and unfold elements, or type a query into 'Test an XPath' to see which nodes match.

No .xml file to hand? Download a sample XML file (2.2 KB) and try it.

Try it now

What Is an XML Formatter?

An XML formatter, also called a beautifier or pretty printer, rewrites XML with one element per line and indentation that shows how elements nest. This one also acts as a validator for well-formedness, meaning every tag is closed, nested properly and correctly escaped. It does not check a document against a schema such as an XSD.

Why Use Text Tools Online?

Counting words, changing case, pulling emails out of a page or writing an amount in words are small jobs that eat time by hand. These tools do them the moment you paste, and the text stays in your browser.

“Paste once, and let the tool do the fiddly part.”
  • Counts as you type
  • Lists sorted and cleaned
  • QR codes for anything
  • Cheque amounts in words
  • Case changed in one click
  • Emails and links pulled out
  • Citations in APA or Chicago
  • Handy commands for developers

Popular Uses for Text Utilities

Short, repetitive text jobs are what these tools were made for.

  • Essay word limits Check that an essay or application answer is within the word or character limit.
  • Fixing capital letters Turn text typed in CAPS LOCK into normal sentence case without retyping it.
  • Collecting contacts Pull every email address or phone number out of a long message or page.
  • Writing cheques Get a rupee or dollar amount written correctly in words for a cheque or invoice.
  • QR codes Make a QR code for a website link, contact card, email address or event.
  • Reference lists Format a book or website reference in APA or Chicago style for an assignment.
  • Tidying lists Sort lines alphabetically, remove repeats or add numbers to a pasted list.
  • Command helpers Build a cron schedule, git command or chmod setting without searching the manual.

What This XML Beautifier Includes

Errors with line numbers

The first problem is reported with its line, column and a plain explanation, plus the parser's original message to search for.

Tree view

Browse elements as a folding tree with 'Expand all' and 'Collapse all', useful for deep configuration files.

XPath tester

Run an XPath 1.0 query and see the count of matches and their values, with a hint when a default namespace gets in the way.

Minify option

Strip the indentation back out to make the smallest possible file for sending over an API.

Why Use ToolXkit for XML Formatter?

Your files stay with you

Everything runs inside your browser. Nothing you open or type is uploaded to a server.

Writing and Text Tools for Different Users

Students

Count words, format citations and tidy notes before submitting coursework.

Writers and bloggers

Change case, find repeated words and check length before publishing a piece.

Office workers

Clean up pasted lists, find and replace names and write amounts in words.

Marketers

Extract emails, links and hashtags from pages and make QR codes for campaigns.

Developers

Encode Base64, build cron lines and generate git and shell commands quickly.

Accountants

Write invoice and cheque amounts in words and tidy columns of pasted figures.

Best Times to Clean Up Text

Text tools save time when you are:

  • Keeping to a word limit
  • Fixing text typed in capitals
  • Building a contact list from emails
  • Writing out a cheque
  • Printing a QR code poster
  • Finishing a reference list
  • Removing repeats from a list
  • Setting up a scheduled job

Tips for Working With XML

  1. Unescaped ampersands trip up XML more than anything else. Replace a lone & with &, or put that text inside CDATA.

  2. If an XPath like //item finds nothing, the document probably has a default namespace. Use //*[local-name()='item'] instead.

  3. Sort attributes A to Z before comparing two versions of a file in a diff tool. Order differences then disappear.

  4. Remove comments before sharing an export with a client if the comments contain internal notes.

  5. Use Download to save the formatted file with an .xml extension, ready to open in any editor.

Frequently Asked Questions

Answers to common questions about this tool.

How do I find the error in my XML file?

Paste it into the input box. If it is not well formed, a red message gives the line and column where the parser stopped, with a plain description such as an unclosed tag. Fix that spot, and the next error, if any, appears.

Does this validate XML against an XSD schema?

No. It confirms well-formedness, which every parser needs first. Schema validation, which checks allowed elements and data types, needs the XSD file and a separate validator.

Can I format a large XML file?

Yes, within what your device's memory allows. Processing is local, so a file of several megabytes formats fine on a normal computer, though the tree view is easier to use on smaller documents.

What is the difference between Text and Tree view?

Text shows the formatted XML as code you can copy or download. Tree shows the same document as nested rows you can open and close, which is quicker for exploring deep structures.

Does my XML leave my computer?

No. Parsing, formatting and XPath queries all happen in your browser. Configuration files, invoices and API responses stay on your machine.

Is my text sent anywhere when I use XML Formatter?

No. The text you paste is handled in your browser and never leaves the page. That makes it safe for drafts, customer lists and anything else you would rather keep to yourself.

Is there a limit on how much text I can paste?

The site sets none. Long documents are handled by your own device, so a whole book may be slow on an older phone. Articles, essays and long lists are no trouble.

Can I use XML Formatter without making an account?

Yes. There is no login, no email to hand over and no daily limit. Open the page, paste or type, and copy or download the result when it is ready.

Why does my word count differ from Microsoft Word?

Programs treat hyphenated words, numbers and symbols a little differently. The gap is usually a few words in a long piece. If a teacher or portal sets a limit, stay a little under it to be safe.

Do the QR codes made here expire?

No. The information is stored directly in the pattern, with no redirect through our servers, so the code keeps working for as long as the link or text inside it stays valid.

Further reading

  • Unicode Consortium The body that sets how letters, symbols and emoji from every language are stored as text.
  • Letter case (Wikipedia) The rules and names for upper case, lower case, title case and the styles programmers use.
  • Base64 (MDN) A plain explanation of Base64, the encoding used to carry files and images as text.

More Text & Developer Tools

Other free tools for the same kind of job.

Browse all tools