Skip to content

YAML Validator — Check YAML Syntax Online

Validate YAML syntax and see errors with line numbers — free, instant, and browser-based.

Last updated:

Why Validate YAML Before Deploying

YAML is the configuration language of choice for CI/CD pipelines, Kubernetes manifests, Docker Compose files, Ansible playbooks, and dozens of other infrastructure tools. Unlike JSON, YAML relies on indentation to express structure -- and that makes it dangerously easy to introduce invisible errors. A single misplaced space can change the meaning of an entire document without any obvious visual clue.

The consequences of invalid YAML range from minor annoyance to serious production incidents. A broken docker-compose.yml might refuse to start your services. A malformed Kubernetes manifest could silently deploy the wrong configuration, exposing ports or mounting volumes you never intended. GitHub Actions workflows with YAML errors will simply fail on push, wasting CI minutes and blocking your team.

Validating YAML before it reaches your pipeline catches these problems at the earliest possible stage. This tool parses your input against the YAML specification and reports precise line numbers and error descriptions so you can fix issues in seconds rather than debugging a failed deployment.

Common YAML Syntax Errors

Even experienced developers trip over YAML's whitespace-sensitive syntax. Here are the most frequent mistakes this validator catches:

  • Inconsistent indentation -- YAML requires spaces (not tabs), and every level must use the same number of spaces. Mixing two-space and four-space indentation within the same block creates a parse error.
  • Tabs instead of spaces -- The YAML specification explicitly forbids tab characters for indentation. Many editors insert tabs by default, which produces a cryptic bad indentation error.
  • Duplicate keys -- YAML technically allows duplicate keys at the same level, but the last value silently overwrites the first. Strict validators flag this because it almost always indicates a copy-paste mistake.
  • Unquoted special characters -- Values containing colons, hash symbols, square brackets, or curly braces can confuse the parser. For example, message: hello: world is ambiguous. Wrapping the value in quotes resolves it: message: "hello: world".
  • Wrong multiline syntax -- YAML offers | (literal block) and > (folded block) for multi-line strings, but forgetting to indent the continuation lines will truncate or break the value.

YAML 1.1 vs YAML 1.2: Key Differences

Most YAML parsers in the wild still default to YAML 1.1, but the current specification is YAML 1.2 (released in 2009). The differences are subtle yet can cause real bugs when you move YAML files between tools that use different spec versions.

The biggest change is boolean handling. In YAML 1.1, the words yes, no, on, off, y, and n are all interpreted as booleans. This is the infamous "Norway problem" -- a country code of NO becomes false. YAML 1.2 restricts booleans to only true and false.

Octal numbers also changed. YAML 1.1 uses a leading zero (0777), while YAML 1.2 adopts the 0o777 prefix consistent with JSON Schema and most programming languages. If your YAML includes file permissions like 0644, the parser version determines whether that is the integer 644 (decimal) or 420 (octal).

When in doubt, quote any value that could be misinterpreted. Quoting "yes" or "0644" guarantees the value stays a string regardless of the parser version.

Tips for Writing Valid YAML

Following a few simple habits will save you from the vast majority of YAML validation errors:

  • Configure your editor to use spaces -- Set your IDE or text editor to insert two spaces per indent level and convert tabs to spaces automatically. VS Code, IntelliJ, and Vim all support this per-filetype.
  • Quote strings with special characters -- If a value contains :, #, {, }, [, ], or starts with * or &, wrap it in double or single quotes.
  • Use a linter in CI -- Tools like yamllint can enforce consistent style rules (line length, key ordering, comment spacing) beyond basic syntax validation. Adding it to your pre-commit hooks catches errors before they reach the repository.
  • Avoid anchors and aliases in config files -- While YAML supports &anchor and *alias for reusing values, not all consumers support them (notably GitHub Actions). Prefer explicit repetition or use a templating layer like Helm or Kustomize instead.
  • Validate before committing -- Paste your YAML into this validator as a quick sanity check. It parses the document instantly in your browser with zero data sent to any server, so even sensitive configuration files stay private.

Related YAML and Data Format Tools

Once your YAML is valid, you may need to convert or reformat it. Use the YAML to JSON converter to transform YAML configuration into JSON for APIs or tools that require it. Going the other direction, the JSON to YAML converter turns JSON payloads into clean, human-readable YAML.

If you work with JSON regularly, the JSON Formatter and Validator provides syntax checking and pretty-printing with adjustable indentation. All of these tools run entirely in your browser -- your data never leaves your machine.

Frequently Asked Questions

What YAML features are validated?
The validator checks all standard YAML syntax including mappings, sequences, anchors, aliases, multi-line strings, flow collections, and comments. It follows the YAML 1.2 specification.
Does it show where the error is?
Yes. When an error is found, the validator shows the error message and the line number where the problem was detected.
Is my YAML data kept private?
Yes. This tool runs entirely in your browser. Your YAML is never sent to any server.
Which YAML version does it validate against?
YAML 1.2, the current standard. YAML 1.1 (which treats `yes`/`no` as booleans) is not the default. If your YAML depends on 1.1 behavior, test with your target parser.
Does it check my schema or just syntax?
Syntax only. The validator confirms that your YAML parses without errors — it does not verify that the structure matches a schema like OpenAPI or a Kubernetes CRD. For schema validation, use a schema-specific tool.
What is the most common YAML error?
Indentation mistakes. YAML uses indentation to express structure, and mixing tabs and spaces is the top cause of parse errors. Use only spaces, pick one indent level (usually 2), and stick to it.

Related Tools