Key facts
- Structure is defined by indentation with spaces; tab characters are not allowed for indentation.
- MIME type is application/yaml (registered in RFC 9512, 2024); .yaml and .yml are interchangeable extensions.
- Supports comments with #, multi-line strings with | and >, anchors (&) and aliases (*), and multiple documents separated by ---.
- YAML 1.2 is a superset of JSON, but many parsers still follow YAML 1.1, where unquoted yes, no, on and off become booleans.
- Usually hand-written by developers and DevOps engineers, or generated by tools like Helm and Kustomize.
How to open a .yaml file
Open it in VS Code (with the Red Hat YAML extension for validation) or Notepad++. Avoid Notepad's default settings if it inserts tabs.
Open it in VS Code or any code editor; install yamllint with Homebrew (brew install yamllint) to check it in Terminal.
Edit it in any text editor and run yamllint file.yaml to validate, or python3 -c 'import sys,yaml; yaml.safe_load(open(sys.argv[1]))' file.yaml if PyYAML is installed.
Common problems and fixes
- "found character '\t' that cannot start any token"
- A tab was used for indentation. Replace tabs with spaces and set your editor to insert spaces in YAML files.
- "mapping values are not allowed here"
- Usually a missing space after a colon, a colon inside an unquoted value, or wrong indentation on the line above. Add the space after key: or quote values that contain colons.
- "did not find expected key" or "bad indentation of a mapping entry"
- One line is indented by a different number of spaces than its siblings. Align items at the same level and check list dashes line up.
- Values like NO, yes, 012 or 1.10 come out wrong
- YAML 1.1 parsers turn NO into false, 012 into an octal number and 1.10 into 1.1. Quote values that must stay strings, for example country: "NO" or version: "1.10".
Often converted to or from: JSON, TOML, INI, .env, XML