YAML Formatter validates and reformats YAML documents with consistent indentation, sorted keys, and proper quoting. Paste any YAML β configuration files, Kubernetes manifests, GitHub Actions workflows, Docker Compose files β and the formatter outputs clean, standardized YAML. It also converts between YAML and JSON and highlights syntax errors with line numbers.
YAML (YAML Ain't Markup Language) is a human-readable data serialization format widely used for configuration files. It uses indentation for structure (like Python) and supports strings, numbers, booleans, nulls, arrays, and objects. YAML is the configuration language for Kubernetes, Ansible, GitHub Actions, Docker Compose, CircleCI, Travis CI, and most modern DevOps tooling.
YAML has several non-obvious behaviors that cause bugs: the Norway Problem (the string 'NO' is parsed as boolean false in YAML 1.1), numeric misparse ('011' is parsed as octal 9 in YAML 1.1 but as string '011' in YAML 1.2), and implicit type coercion (bare yes/no/true/false become booleans). The formatter explicitly quotes values that could be misinterpreted, preventing these bugs in production configuration.
Kubernetes Pod manifest
Result: Validates apiVersion, kind, metadata, spec structure and reformats with consistent 2-space indentation
GitHub Actions workflow with irregular indentation
Result: Normalizes indentation and quotes string values that could be misinterpreted as numbers or booleans
Docker Compose file
Result: Validates service definitions, volume mounts, and environment variable syntax, then formats cleanly
What causes 'did not find expected key' errors in YAML?
Usually a tab character used for indentation instead of spaces. YAML requires spaces β tabs are not allowed. This is a common copy-paste error from code editors that insert tabs. The formatter converts tabs to spaces automatically.
What is the Norway Problem?
In YAML 1.1, the bare value NO (and no, No, false, False, FALSE, off, Off, OFF) is parsed as boolean false. Country codes like 'NO' (Norway) in configuration files become boolean false, causing unexpected behavior. The fix: always quote string values that look like booleans. YAML 1.2 removed this behavior, but many parsers still use 1.1.
What is the difference between YAML and JSON?
JSON is a strict subset of YAML (any valid JSON is valid YAML). YAML is more human-friendly: supports comments (#), multiline strings (| and > block scalars), references and anchors (&anchor / *anchor), and does not require quotes around most strings. JSON is more portable and faster to parse.
How do I write a multiline string in YAML?
Use the literal block scalar (|) to preserve newlines, or the folded block scalar (>) to fold newlines into spaces. Example: description: |\n Line one.\n Line two. preserves the newlines. description: >\n Line one.\n Line two. becomes 'Line one. Line two.'
What are YAML anchors and aliases?
Anchors (&name) mark a node for reuse; aliases (*name) reference it. This avoids repeating the same content: define a common configuration block once with &defaults, then merge it into multiple services with <<: *defaults. The formatter preserves but does not collapse anchors.