TapCub is live — analytics, insights and live chat, free on one platform

Free tool XML formatter, SQL formatter and YAML validator

Paste a one-line SQL query, a minified sitemap or a CI config. The formatter lays it out with consistent indentation, and when the text is broken it says where: the line, the column and what the parser expected.

  • SQL · XML · YAML
  • Errors by line
  • Runs locally
Formatter

Format and check

The sample is a sitemap squeezed onto one line. Load the SQL or YAML example with the buttons, or paste your own; the result updates as you type.

Paste text or open a file. Files stay on this device.

Well-formed. The result below is formatted.

Lines

18

In the formatted result.

Size (bytes)

696

UTF-8 size of the formatted result.

Elements

12

Every XML element, nested ones included.

Formatted XML
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
  <url>
    <loc>https://www.example.com/</loc>
    <lastmod>2026-11-10</lastmod>
    <xhtml:link rel="alternate" hreflang="en" href="https://www.example.com/"/>
    <xhtml:link rel="alternate" hreflang="zh-Hans" href="https://www.example.com/zh/"/>
  </url>
  <url>
    <loc>https://www.example.com/pricing?plan=pro&amp;billing=yearly</loc>
    <lastmod>2026-11-02</lastmod>
  </url>
  <!-- blog posts are listed in sitemap-blog.xml -->
  <url>
    <loc>https://www.example.com/blog/utm-guide</loc>
    <lastmod>2026-10-28</lastmod>
  </url>
</urlset>
Runs entirely in your browser. Nothing you type here is uploaded or stored by TapCub.

Version v1.0Updated Update history

Read the result

Valid, broken, or valid but surprising

Every format gets the same three kinds of feedback. The summary line above the result tells you which one you have.

Errors

The text cannot be parsed. For XML and YAML this is where a strict parser stops; for SQL it is an unclosed quote, comment or bracket, or a spot the formatter could not read. The line and column point at the problem or just after it.

Checks

The text is valid, but something in it is likely to bite later: a YAML value that another parser reads as a different type, or a TapCub SQL rule the playground would reject. Each check says what will happen and how to avoid it.

Notes

What the formatter changed beyond whitespace: YAML comments and anchors are not carried over, compact mode drops comments.

Counts

Lines and bytes of the result, plus a count for the format: XML elements, SQL statements, YAML documents and keys. A sitemap's element count is a quick check that all URLs made it in.

XML and SQL are reformatted from the original text, so values never change. YAML is parsed and written out again, so equivalent values may be written differently: 3.10 becomes 3.1 and an empty value becomes null, exactly as any program reading the file would see them.

How to use it

Three steps

Nothing to install; the text never leaves your browser.

  1. 1

    Pick the format

    XML, SQL or YAML. For SQL, also pick the database, because quoting and comment rules differ: # starts a comment in MySQL, [name] is a quoted name in SQL Server.

  2. 2

    Paste or open

    Paste the text or open a .xml, .sql or .yaml file. Errors and checks appear under the counts, each with its line number.

  3. 3

    Copy or download

    Copy the formatted result or download it. Use Compact to squeeze XML or SQL onto one line for a config value or an API call.

Rules

What is checked, and against which rules

Each format has its own definition of valid. The tool follows the published specification where there is one, and says so where it relies on a library.

  • XML: the well-formedness rules of XML 1.0 (Fifth Edition). It stops at the first fatal error, as conforming XML parsers must. DTD and schema validation are not done
  • SQL: formatting by sql-formatter 15.9.0; quotes, comments and brackets are checked separately for every dialect. Table and column names are not checked against any database
  • YAML: parsed as YAML 1.2 by js-yaml 4.3.2 (duplicate keys and tab indentation are errors), then checked line by line for values YAML 1.1 parsers read differently
Main checks by format, with the rule behind each
FormatCheckRule
XMLOne root element; tags closed and nested in orderXML 1.0 §2.1, §3
XMLAttributes quoted, no duplicates, no < in valuesXML 1.0 §3.1
XML& starts an entity or character reference; only five entities are predefinedXML 1.0 §4.1, §4.6
XMLNo -- inside comments; declaration first in the fileXML 1.0 §2.5, §2.8
SQLStrings, quoted names and block comments closed; brackets balancedEach dialect's quoting rules
SQL · TapCubOne SELECT or WITH, no comments, semicolons, backticks or writes, at least one of the four viewsSame checks as the SQL playground in TapCub Insights
YAMLIndentation, duplicate keys, unclosed quotes and bracketsYAML 1.2.2
YAMLUnquoted yes / no / on / off, leading zeros, 3.10, 22:22YAML 1.1 types (yaml.org/type)
Worked example

The YAML example, read by two parsers

The YAML example is a CI workflow. It is valid, yet the values in the first two rows mean different things depending on the parser that reads them; the last three rows are other common cases. This is what the checks warn about.

How YAML 1.2 and YAML 1.1 parsers read the same plain values
Written asYAML 1.2 (this tool, js-yaml)YAML 1.1 (for example PyYAML)Safe form
on: as a keythe string "on"the boolean true"on":
3.10 in a version listthe number 3.1the number 3.1"3.10"
0755the number 755the number 493 (octal)"0755" or 0o755
2222:22 (port mapping)the string "2222:22"the number 133342 (base 60)"2222:22"
nothe string "no"the boolean false"no"

GitHub Actions reads on: correctly, so the workflow runs; the warning matters when the same file is read by a Python script or another YAML 1.1 tool. The version list is wrong for every parser: 3.10 asks for Python 3.1.

Common mistakes

Why these files fail to parse

Most errors come from writing one format with the habits of another.

HTML habits in XML

Unquoted attributes, <br> without a closing slash, &nbsp; and attributes without values are fine in HTML and fatal in XML. Use <br/> and &#160;.

A raw & in a sitemap URL

The sitemaps.org protocol requires entity escaping in URLs, so a link with several query parameters is written with &amp; inside <loc>. A sitemap that is not well-formed cannot be read at all, so search engines report an error instead of the URLs.

YAML that changes type

Versions, ZIP codes, port mappings and words like no or on need quotes. The file still parses, so nothing fails until a value arrives as the wrong type.

Formatted is not the same as correct

A query can format cleanly and still name a column that does not exist. The SQL check is about syntax; run the query to check the meaning.

FAQ

Formatter questions

Still have a question?

Chat with the team behind TapCub — we usually reply within a few hours on business days.

How do I format XML online and check that it is valid?

Paste it with XML selected (the default): elements are indented by level and the result can be copied or downloaded. "Well-formed" means it follows the XML 1.0 syntax rules: one root, matching tags, quoted attributes, escaped & and <. Validation against a DTD or XSD schema is a separate step this tool does not do.

How do I format SQL online?

Choose SQL, pick your database in the dialect list and paste the query. Keywords are uppercased (or lowercased) and each clause goes on its own line. If the query has an unclosed quote or bracket, you get the line and column instead of a half-formatted result.

Which SQL dialect should I choose?

The database the query runs on. Dialects differ in quoting (`name` in MySQL, [name] in SQL Server, "name" in PostgreSQL), comments and some keywords. For TapCub's SQL playground choose TapCub SQL: it formats like MySQL and adds the playground's rules.

Why did 3.10 turn into 3.1 in my YAML?

Because unquoted 3.10 is a number, and the number 3.10 is 3.1. Every YAML parser does this; formatting just makes it visible. Quote version numbers: "3.10". The checks list flags these values before they cause a wrong install.

Why are my YAML comments gone after formatting?

YAML is formatted by parsing it and writing the data out again, and comments are not part of the data. The tool tells you how many were dropped. If you only want to validate, read the checks and keep your original text.

Does the SQL formatter check that my query will run?

No. It checks syntax that does not depend on your database: closed quotes, comments and brackets, and whether the formatter can read the statement. Whether tables and columns exist, or whether you have permission, only the database can tell.

What is the Norway problem in YAML?

In YAML 1.1 an unquoted NO, the ISO code for Norway, is the boolean false. YAML 1.2 fixed this, but many tools still parse 1.1. The same applies to yes, on and off; this tool flags them in block values.

Is my data uploaded?

No. Formatting and checking run in your browser; the SQL and YAML libraries are downloaded once from tapcub.com and run locally. There is no share link, so pasted queries and configs never end up in a URL.

Changelog

Update history

New features, fixes and data refreshes for this tool, newest first.

  1. · v1.0

    LaunchedFirst release.

Missing something or found an error? Tell us — requests that come up often go into the next update. All tool updates

Next step

Query your own analytics with SQL

Built-in reports cover most questions. When they do not, Insights pro mode lets you write SQL over your project's events, sessions and people.

See your data clearly. Find your growth.

Every click, backed by data. Install one line of code and see your first numbers in a minute.

No credit card · Free plans for analytics and chat · Cookieless analytics