curly{bits}

curlybits / YAML Validator

YAML Validator & Formatter

Paste YAML to check it instantly. Valid files show a summary and a cleanly formatted copy; invalid ones show what's wrong and the exact line and column, with a button to jump straight there. Handy for Docker Compose, Kubernetes, GitHub Actions and Ansible files.

Input YAML
Result

      

How to use the YAML Validator & Formatter

  1. Paste your YAML into the left box, or click Load sample.
  2. Read the result under the boxes: ✓ Valid YAML, or the error with its line and column.
  3. Click Go to line to jump to the problem, fix it, and the check runs again as you type.
  4. Copy the formatted YAML on the right if you want consistent indentation.

YAML vs JSON

YAMLJSON
StructureIndentation (spaces only, never tabs)Braces {} and brackets []
CommentsYes, with #No
QuotesUsually optionalRequired around keys and strings
Multiple documentsYes, separated by ---One value per file
Used forConfig: Docker Compose, Kubernetes, GitHub Actions, AnsibleAPIs, data exchange, package.json

Every JSON document is also valid YAML 1.2, so YAML parsers can read JSON directly. Going the other way loses comments, because JSON has no place for them.

Common YAML gotchas

  • Tabs: YAML doesn't allow tab characters for indentation. Use spaces.
  • Unquoted surprises: on, yes and no are plain strings in YAML 1.2 (which this tool follows), but older YAML 1.1 parsers read them as true or false. Quote them to be safe, like "yes".
  • Colons in values: a value like time: 12:30 or a URL with : may need quotes.
  • Leading zeros: zip: 01234 may be read as a number. Quote codes, IDs and version numbers like "3.10".

What the validator checks

It checks that the file is well-formed YAML 1.2: indentation, quotes, brackets, duplicate keys and multiple documents. It doesn't know the rules of a particular tool, so a file can be valid YAML and still have a setting Docker or Kubernetes doesn't recognise.

Frequently asked questions

Does it catch duplicate keys?

Yes. A mapping with the same key twice is reported as an error, with its line.

Why does the formatted output lose my comments?

The formatted copy is rebuilt from the parsed data, which has no comments. Your original text is untouched.

Is my file uploaded?

No. Validation runs in your browser.

Add this YAML validator to your website

Free for blogs, schools and businesses. Copy the code below and paste it into your page's HTML. The tool works exactly like this one and runs in your visitors' browsers, so nothing is uploaded. Please keep the credit line so others can find it too.

Preview embed ↗