"category": "inspect-and-test",
YAML Validator
"tldr": Paste YAML and validate it instantly - syntax errors reported with line numbers, valid documents shown in normalized form.
Paste any YAML document - a Kubernetes manifest, GitHub Actions workflow, docker-compose file, or application config - and validate it instantly. Errors are reported with the exact line and column; valid documents are echoed back in normalized form with a structure summary.
YAML fails differently than JSON: indentation is structure, so one wrong space silently changes meaning or breaks parsing three lines later. Validating before you commit or apply catches the tab-instead-of-spaces and misaligned-list mistakes that CI failures are made of.
How to validate YAML
- 1Paste your YAML document - full YAML 1.2 is supported, including anchors and flow style.
- 2Syntax errors are reported with line and column immediately.
- 3Valid documents show a structure summary plus the normalized form.
- 4Compare the normalized form against your intent - indentation bugs often parse "successfully" into the wrong structure.
Convert YAML to Validation result in code
import yaml # pip install pyyaml
try:
data = yaml.safe_load(text)
except yaml.YAMLError as e:
print(f"invalid: {e}")# yamllint checks syntax AND style (indentation, line length)
pip install yamllint
yamllint -d relaxed config/*.yamlFrequently asked questions
My YAML is "valid" but Kubernetes still rejects it. Why?
Syntax validation checks YAML grammar, not the schema. A manifest with "aipVersion" instead of "apiVersion" is perfectly valid YAML. For schema-level checks, use kubectl apply --dry-run=server, kubeconform, or your tool-specific validator after syntax passes here.
Why did my value parse as a string when I meant a number (or vice versa)?
YAML infers types: 8080 is a number, "8080" is a string, and 08 or 1e2 can surprise you. The normalized output shows exactly how each value was typed - quote anything that must stay a string (versions, phone numbers, octal-looking IDs).
Are tabs really forbidden in YAML?
For indentation, yes - the spec requires spaces. A tab produces errors like "found character that cannot start any token". Configure your editor to insert spaces for .yaml files; most CI YAML failures trace back to exactly this.
Does this handle multi-document files (---)?
This validator processes one document at a time - paste each section separated by --- individually. Multi-doc streams are how Kubernetes bundles resources; validating each document separately also isolates which one is broken.
Last updated:
You might also need
Free and in-browser, like everything on JSON Console. Browse all tools →