What Is a .YAML File? (.yaml, .yml)
A .yaml or .yml file is a plain-text data file in YAML, a human-friendly format that uses indentation instead of brackets to structure lists and key-value pairs. It is the standard for configuration in Docker Compose, Kubernetes, GitHub Actions, Ansible and many apps. Both extensions mean exactly the same thing.
- Extension
- .yaml, .yml
- Full name
- YAML Ain't Markup Language
- Type
- Code and web file
- MIME type
- application/yaml
About YAML files
YAML expresses the same data structures as JSON (in fact YAML 1.2 is a superset of JSON) but is easier to read and write by hand: name: value pairs, lists with leading dashes, nesting by indentation, and comments starting with #. That readability is why DevOps and CI tools chose it for configuration.
Indentation is part of the syntax, so a single wrong space breaks a file, and tabs are not allowed for indentation at all. Another classic trap is implicit typing: in YAML 1.1 parsers, unquoted values such as no, yes, on and off become booleans, so the country code NO can turn into false. Quoting strings avoids surprises.
The .yml extension is a holdover from three-letter extensions; the YAML project recommends .yaml, but tools accept both. Some tools look only for one spelling of a specific file name, such as docker-compose.yml versus compose.yaml, so check the tool's docs. Loading YAML from untrusted sources with unsafe loaders can execute code in some languages; use safe loading functions.
What YAML files are used for
- Docker Compose and Kubernetes configuration
- CI/CD pipelines such as GitHub Actions and GitLab CI
- Ansible playbooks and infrastructure as code
- App settings, OpenAPI specs and static site front matter
How to open a .yaml file
Windows
Open in Notepad, or VS Code for syntax highlighting and indentation guides.
Mac
Use TextEdit in plain-text mode or VS Code.
Linux
Any text editor; the yq command-line tool queries and edits YAML.
Online / any browser
GitHub and GitLab display YAML with highlighting; online validators catch indentation errors, but avoid pasting secrets.
How to convert a .yaml file
To convert YAML to JSON, use yq (yq -o=json file.yaml) or a few lines of Python with PyYAML; JSON to YAML works the same way in reverse.
Renaming .yml to .yaml (or the reverse) is safe for the content, but a tool that expects a specific file name may stop finding it.
Changing the extension in the file name does not convert the file. See how to change a file extension for when renaming is safe.
Naming and renaming YAML files
- Use the exact name your tool expects (compose.yaml, .github/workflows/deploy.yml); a different spelling means it is ignored.
- Pick .yaml or .yml and use it consistently across a repository so files are easy to find and glob.
- Name environment-specific files with a suffix (values-staging.yaml, values-prod.yaml) rather than copies named new or final.
Renaming lots of .yaml files? Use the free online bulk renamer for patterns and numbering, or try File Renamer AI to name each file from what is inside it.
Related file types
A .json file is a plain text data file in JavaScript Object Notation, a lightweight format of names, values, lists and nested objects. It is the standard way web APIs exchange data and a common format for app settings, exports and configuration. Any text editor opens JSON, and browsers can display it nicely.
A .xml file is a plain text data file in Extensible Markup Language, which stores information in nested, self-describing tags such as <invoice> and <total>. It is used for data exchange, configuration, sitemaps, RSS feeds and document formats. Any text editor or browser can open an XML file.
A .ini file is a plain-text configuration file that stores settings as key=value pairs grouped under [Section] headings. Windows programs, games and many cross-platform tools use INI files for options such as resolution, paths and preferences. Any text editor, including Notepad and TextEdit, can open and edit them.
A .cfg file is a configuration file that stores settings for a program, game or device, usually as plain text. There is no single CFG format: some use key=value lines like INI, others lists of commands or JSON-like blocks. Notepad, TextEdit or VS Code open them; the owning program decides what each line means.
Frequently Asked Questions
What is the difference between .yaml and .yml?
None in content. .yaml is the officially recommended extension; .yml is a shorter variant, and tools read both the same way.
Why does my YAML file give an error?
Usually inconsistent indentation or a tab character. Use spaces only and check alignment in an editor like VS Code.
Can I convert YAML to JSON?
Yes, with yq, a short Python script or an online converter; the data maps directly.
Is YAML the same as JSON?
YAML 1.2 can represent everything JSON can, and valid JSON is valid YAML, but YAML adds comments and indentation-based syntax.