# XML formatter

> Format supplied XML without resolving external entities.

[Open tool](https://www.toolcabana.com/fa/xml-formatter) · [توسعه و داده](https://www.toolcabana.com/fa/category/developer-and-data)

Tool ID: xml-formatter. Requested language: fa. Description language: en. Complete guide translation: no; untranslated sections use English.

## Overview (en)

XML formatter checks supplied XML for well-formedness and reformats the markup with consistent indentation from 1 to 8 spaces. Syntax problems are reported with a line number. DOCTYPE and entity declarations are refused, so no external entities are ever resolved during formatting.

## Supported tasks (en)

Format supplied XML without resolving external entities.

## Steps (en)

1. Paste the source into the input editor, or load the built-in example.
2. Set indent spaces.
3. Run xml formatter, review the output, then use the available copy or download controls.

## Settings

- Indent spaces (en; key: indent; type: number); minimum: 1; maximum: 8

## Limitations (en)

Text operations generally accept up to 2,000,000 characters. Individual parsers, generators and formulas apply additional limits shown by their controls.

## Example input

```text
<root><name>ToolCabana</name><count>2</count></root>
```

## Privacy and connections (en)

This operation processes its source in your browser. Copy and download are explicit actions; source input is not saved in an account or history.

## Questions (en)

### Why does the XML formatter reject my DOCTYPE?

Documents containing DOCTYPE or ENTITY declarations are refused with an error. Remove the declaration to format the remaining markup; this prevents external or expanding entities from being processed.

### How does the XML formatter report errors?

The XML is validated before formatting. If it is not well-formed, such as an unclosed tag, you get the line number and a description of the problem instead of formatted output.

### Can I change the indentation of formatted XML?

Yes. The Indent spaces setting accepts whole numbers from 1 to 8, with 2 as the default. Short elements that fit on one line may be kept on a single line.

### Where is my input processed?

This operation processes its source in your browser. Copy and download are explicit actions; source input is not saved in an account or history.

### What are the input limits?

Text operations generally accept up to 2,000,000 characters. Individual parsers, generators and formulas apply additional limits shown by their controls.

## Related tools

- [XML to JSON](https://www.toolcabana.com/fa/xml-to-json)
- [SQL formatter](https://www.toolcabana.com/fa/sql-formatter)
- [HTML beautifier](https://www.toolcabana.com/fa/html-formatter)
- [CSS beautifier minifier](https://www.toolcabana.com/fa/css-formatter)
