What is the YML file format?
.yml is a plain-text file and a data interchange format. It is a standardized, platform-independent format that stores data as human-readable text, organized through an indentation-based key: value structure. .yml files can be read and written using YAML libraries available for virtually every major programming language. .yml and .yaml identify the same format - .yml is the older three-letter form retained by many tools such as docker-compose.yml, .gitlab-ci.yml, and GitHub Actions workflows. The format is most commonly used for data serialization and application configuration.
Serialization is a term used in computer science and refers to the concept of exchanging data between programs or applications using well-defined objects. An object can be understood as a data container. For example, database records are a form of data serialization as they can be easily exchanged between various databases. Serialized data can also take the form of structured files which can be sent between applications. Among the most widely used serialization formats are .yml, XML, JSON, and TOML.
A distinctive feature of .yml is its use of significant whitespace: indentation defines the document structure, and only spaces are permitted - tabs are explicitly forbidden by the specification. Documents may optionally open with --- (document start) and close with .... YAML also supports inline # comments, multi-line block scalars using | or >, and anchors (&) with aliases (*) for reusing repeated values.
Security & safety
RISK: MEDIUMA .yml file is plain text and doesn't execute on its own, so reading one is safe. Two real risks: (1) config YAML (CI pipelines, Compose, K8s, Ansible) frequently contains secrets - tokens, passwords, keys - so don't paste it into untrusted online validators or commit it publicly. (2) Programmatic danger: loading untrusted YAML with an unsafe parser (e.g. PyYAML's yaml.load instead of yaml.safe_load) can execute arbitrary objects/code - always use the safe loader for files you don't trust. Editing risk: a tab or misaligned space silently changes meaning, so validate after editing.
Format details
in a nutshell- Strangereal IFL camera-map (rare) - A few legacy apps reused .yml for non-YAML data, but today the extension is virtually always YAML text.
Programs that open YML files
Technical details
deep spec| MIME type | application/yaml (IANA-registered); legacy variants include text/yaml, text/x-yaml, application/x-yaml |
| Encoding | UTF-8 (default and most common); UTF-16 and UTF-32 with BOM are permitted by the spec but rarely used in practice |
| File structure | Indentation-based mappings (key: value), sequences (- item), and scalars; nesting is expressed purely by indentation level |
| Significant whitespace | Indentation defines structure; only spaces are allowed - tabs are explicitly forbidden by the YAML specification |
| Document markers | Optional --- marks document start; ... marks document end; a single .yml file may contain multiple YAML documents separated by --- |
| Comment support | Inline and full-line comments introduced by # - absent from JSON and most binary serialization formats |
| Native data types | String, integer, float, boolean, null, timestamp, and binary (base64-encoded via the !!binary tag) |
| Anchors and aliases | & declares a reusable anchor; * references (aliases) it - eliminates copy-paste repetition in complex configuration files |
| Block scalars | | (literal block scalar) preserves newlines as-is; > (folded block scalar) collapses newlines into spaces |
| JSON superset | Since YAML 1.2 (2009) every valid JSON file is also valid YAML, so YAML parsers can read JSON natively |
| Magic bytes / signature | None - no binary header or magic number; identified by its indentation-based key: value structure and the .yml or .yaml extension |
| File size (typical) | Bytes to tens of KB for configuration and CI/CD pipeline files; rarely exceeds a few hundred KB |
| Extension equivalence | .yml and .yaml are identical in format; .yml is the three-letter DOS-era form adopted by docker-compose.yml, .gitlab-ci.yml, and GitHub Actions |
| Spec version directive | Optional %YAML 1.2 pragma at file start declares the spec version; most files omit it and rely on parser defaults |
| Released | 2001 (YAML 1.0); YAML 1.1 (2005); current YAML 1.2 (2009, revised 1.2.2 in 2021) |
| Latest version | YAML 1.2.2 (2021) |
| Open standard | Yes · royalty-free |
| Specification | yaml.org |
YML conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about YML files.