DevToolsmith

YAML Validator

Paste YAML to check its syntax, with exact line and column numbers for every error. The validator also warns about values that YAML 1.1 parsers silently turn into booleans or numbers, such as no, on, 0644 and 22:22.

Runs 100% in your browser — nothing is uploaded

YAML
Tip: drop a file here252 chars · 252 bytes · 14 lines
Parsed as JSON
302 chars · 302 bytes · 19 lines

✓ Valid YAML, with 4 warnings

  • 6:922:22 is a base-60 number in YAML 1.1 (1342), a classic problem with Docker Compose ports. Quote it ("22:22").
  • 9:16"NO" is a boolean in YAML 1.1 (the “Norway problem”). Quote it ("NO") if you mean the string.
  • 10:14"off" is a boolean in YAML 1.1 (the “Norway problem”). Quote it ("off") if you mean the string.
  • 11:161.10 is a number, so it becomes 1.1. Quote it if it is a version string.

What the validator checks

  • Syntax: indentation, unclosed brackets and quotes, tabs, invalid characters and bad block scalars.
  • Duplicate keys: most parsers silently keep the last value, which hides real bugs.
  • Anchors and aliases: undefined aliases and merge keys (<<: *defaults) are resolved.
  • YAML 1.1 gotchas: unquoted values whose type depends on the parser version.

YAML 1.1 vs 1.2: values that change meaning

YAML 1.2 (2009) removed many implicit types, but PyYAML, Ruby, older Go libraries and tools built on them still follow YAML 1.1. The same file can produce different data depending on who reads it:

YAMLYAML 1.2YAML 1.1 (PyYAML etc.)
country: NO The string "NO" false
enabled: on The string "on" true
mode: 0644 644 420 (octal)
port: 22:22 The string "22:22" 1342 (base 60)
version: 1.10 1.1 1.1

The fix is always the same: quote strings that could look like something else. Docker Compose ports are the classic case. Its documentation recommends always quoting port mappings, because 22:22 unquoted is the base-60 number 1342 in YAML 1.1.

Common YAML errors

Tabs in indentation

server:
  host: localhost
	port: 8080

The validator reports: line 3, column 1: Tabs are not allowed as indentation. Replace the tab with spaces.

Missing space after a colon

key:value is a single string, not a mapping. YAML needs a space after the colon: key: value.

Colons and # inside unquoted values

message: Error: disk full fails because of the second : , and color: #ff0000 is empty because # starts a comment. Quote such values: color: "#ff0000".

Inconsistent indentation

Items at the same level must line up exactly. A list item indented by one extra space becomes part of the previous value or causes a “bad indentation” error.

Validate YAML on the command line

# yamllint: syntax plus style rules (pip install yamllint)
yamllint config.yaml

# Python: syntax only
python3 -c 'import sys, yaml; list(yaml.safe_load_all(sys.stdin))' < config.yaml

# Kubernetes: syntax and schema, without changing anything
kubectl apply --dry-run=server -f deployment.yaml

# Docker Compose: prints the fully resolved file, or the error
docker compose config

Need the data in another format? Convert with YAML to JSON or JSON to YAML.

Frequently asked questions

How do I validate a YAML file?

Paste it into the validator above or drop the file onto the input. Syntax errors are listed with their exact line and column, and the parsed data is shown as JSON so you can confirm the structure is what you meant. Nothing is uploaded.

Can I use tabs in YAML?

No. YAML forbids tab characters for indentation, and parsers reject them with an error. Use spaces, usually two per level. Most editors can convert tabs to spaces automatically for .yaml and .yml files.

What is the Norway problem in YAML?

In YAML 1.1, unquoted yes, no, on, off, y and n are booleans. A list of country codes containing NO (Norway) therefore turns Norway into false. YAML 1.2 fixed this, but PyYAML, Ruby’s Psych and many tools still use 1.1 rules. Quoting the value ("NO") works in every version.

Does this validator support multiple documents?

Yes. Documents separated by --- are each validated, and the JSON preview shows them as an array. This is common in Kubernetes manifests that combine a Deployment and a Service in one file.

Does valid YAML mean my Kubernetes or Compose file is correct?

Not necessarily. This checks YAML syntax and common type pitfalls, not whether a field name is valid for Kubernetes or Docker Compose. Run kubectl apply --dry-run=server or docker compose config to validate against their schemas.