XML Formatter

XML Formatter

Validate XML syntax and indent element-only regions while preserving text, comments, and CDATA. DTD and entity declarations are not supported.

Input and results are processed locally in your browser without upload or storage by this tool. XML and string inputs are not executed; results are shown as text. Shared site advertising and analytics may operate separately, but tool-use events do not include your input contents.

Comments & questions

XML Formatter

Use your browser’s XML parser to check a document and add readable indentation. Subtrees containing text or CDATA are left untouched to protect meaningful whitespace. Parsed XML is never inserted into the live page or executed; output is plain text.

Key features

  • Report malformed XML instead of generating a misleading result.
  • Indent text-free element regions using two or four spaces.
  • Preserve comments, processing instructions, CDATA, and xml:space="preserve" regions.
  • Reject DTD and entity declarations before parsing.

How to use

  1. Enter an XML document with one root element.
  2. Choose indentation or structural reserialization, and select an indent width.
  3. Run, inspect, and copy the output. Keep the original file separately.

Use cases

  • Inspect nested XML API responses.
  • Find mismatched tags in configuration files.
  • Review mixed text-and-tag documents without stripping content whitespace.

Frequently asked questions

Why are some elements not reindented?

Text nodes, including whitespace-only text, can carry meaning. A subtree containing text or CDATA is left unchanged, so existing line breaks are not forcibly reformatted.

Is reserialization the same as minification?

No. Reserialization outputs the parsed DOM as XML but does not remove text whitespace. This avoids deleting spaces between inline elements in mixed content.

Does it validate DTDs or XSD schemas?

DTD and ENTITY declarations are rejected, and XSD validation is not performed. Checks are limited to the XML syntax and structure handled by the browser parser.

Will the output be byte-for-byte identical?

No. Parsing may normalize line endings, entity references, and attributes; serialization may change quotes or empty-element notation. This is not canonicalization for signatures or byte hashes. Limits are 100,000 characters, 10,000 nodes, and depth 100.

Privacy

Input and results are processed locally in your browser without upload or storage by this tool. XML and string inputs are not executed; results are shown as text. Shared site advertising and analytics may operate separately, but tool-use events do not include your input contents.

References

Related Tools

JSON FormatterJSON Structure DiffMIME Type LookupWasm Module InspectorHreflang Matrix CheckerAST Query PlaygroundContainer Build GraphDependency Graph ExplorerSemver Range LabCron Schedule AuditorPatch Review WorkbenchSource Map ExplorerLocalization Catalog AuditorStructured Data ReviewerHTTP Archive AnalyzerWebhook Signature LabProtobuf Schema WorkbenchGraphQL Schema LabAvro Schema EvolutionLocal SQL WorkbenchSchema Form BuilderMesh Repair WorkbenchPipe Network LabRobot Arm Kinematics LabThermal Network LabBeam Response LabGear Train DesignerTolerance Stackup LabSensor Calibration FitPCB Stackup PlannerDigital Filter DesignerNetwork Reachability MapSun Shadow MapGPS Error SimulatorDigital Logic SimulatorAnalog Circuit LabMechanism Linkage LabAnalysis Mesh GeneratorOpenAPI Contract InspectorDatabase Migration PlannerDimensional Equation CheckerTruss Force LabBoolean Minimization LabControl Response LabQueueing Simulation LabGeofence Event SimulatorCoordinate Reference LabSurvey Traverse LabRaster Classification LabChoropleth Design LabMap Print ComposerRaster Reprojection LabElevation Contour MakerTerrain Viewshed LabWatershed DelineatorMap Tile PackagerText File Encoding WorkbenchFilesystem Portability AuditorSBOM License ExplorerFile Signature Auditornpm Lockfile Conflict ResolverSource Secret AuditorOffline Web Package BuilderCertificate Chain InspectorTorrent Metainfo InspectorChunked File PackagerEncrypted File VaultDuplicate File FinderArchive WorkbenchDesign Token ManagerSpacing Token DesignerResponsive Type SystemPackaging Dieline DesignerSVG Icon Sprite PackerFlex Layout PlaygroundCSS Grid PlaygroundRegex Equivalence LabMarkdown Repository AuditorLog Template MinerResponsive Layout AuditorEmail Template PreviewInternal Link GraphState Machine TesterPetri Net SimulatorGit History VisualizerCurl Request WorkbenchBinary Protocol DesignerHex File EditorBinary Patch WorkbenchFile Signature WorkbenchAPI Mock SandboxSchema Column MapperEvent Log SessionizerER Diagram DesignerTime Series Gap AuditorStratified Data SplitterData Lineage DesignerDecision Tree LabData Anonymization WorkbenchData Expectation RunnerJSON Schema ValidatorBasket Pattern AnalyzerRobots Policy TesterSEO HTML AuditorAccessibility Structure AuditorSyndication Feed WorkbenchIndexNow Payload BuilderCrawl Log AnalyzerCSP Policy WorkbenchSearch Performance AnalyzerCSV Formula Risk AuditorCORS Response SimulatorCache Header LabCookie Policy InspectorWeb Vitals Trace LabSitemap Health AuditorBatch File RenamerFile Manifest VerifierFolder Space MapFolder Difference ReviewerRoute Order OptimizerGeoJSON Map EditorPolygon Overlay LabCartographic Label PlacerSpatial Table JoinGeoJSON Topology AuditorGPX Track AnalyzerTrack Privacy RedactorCSV Table JoinCSV Pivot WorkbenchScientific Data ProfilerTabular Cleaning WorkbenchRecord ReconciliationData Dictionary BuilderCanonical Graph AuditorRedirect Plan TesterHTTP response and ping reference testBrowser and System InformationJSON ↔ YAML ConverterXML ↔ JSON ConverterHTML FormatterJavaScript MinifierMock Data Generator.gitignore GeneratorLicense GeneratorUser-Agent ParserPassword Strength CheckerCode to ImageHTTP Status Code LookupJS & SQL String EscapeCSS Box Shadow GeneratorCSS Gradient GeneratorIndent ConverterNumber Base ConverterUnicode Escape ConverterUnicode InspectorMarkdown Table GeneratorBase64 EncoderURL EncoderSQL FormatterCron Expression GeneratorRegex TesterUUID GeneratorHash GeneratorTimestamp ConverterJWT DecoderHTML Entity ConverterMarkdown PreviewCSS MinifierMeta Tag GeneratorJSON ↔ CSVCase ConverterImage to Base64
Explore all Dev Tools tools →Image/Media →Text/Convert →Life/Fun →