File Extension File Extension Guide

What is a YML File?YAML

A technical reference for the .yml extension, a YAML configuration file. What a YML file holds, how to open and read one, how .yml differs from .yaml, and where YAML shows up in tools like Docker and Kubernetes. It is plain, readable text.

YAML Config 📄 Plain Text 👁️ Human-Readable 🔧 DevOps Favourite
.YML

YAML File

Type:Config / data
Extension:.yml, .yaml
Language:YAML
Format:Plain text
Readable:Yes, by design

📖 What is a YML File?

A YML file is a file written in YAML, a data serialization language for storing settings and structured data in a way people can read easily. It uses the .yml extension, and it is plain text, so you can open one in any editor and follow what it says.

YAML stands for "YAML Ain't Markup Language", a playful name that makes the point that it is meant for data rather than documents. Instead of the brackets and tags you see in other formats, YAML leans on simple indentation to show how things relate, which keeps a file tidy and quick to scan.

You most often find YML files acting as configuration, the settings that tell a program or a service how to behave. They have become the go-to choice across modern development tools, where a clear, editable settings file matters more than raw speed.

Key Characteristics

  • Written in YAML, a data language
  • Plain text, open it anywhere
  • Indentation based, no brackets
  • Mostly configuration, settings for tools

Good to Know

  • .yml equals .yaml, the same thing
  • Comments start with #, for notes
  • A superset of JSON, so JSON fits inside
  • Spaces, never tabs, for indenting
💡 Why it matters: A YML file is where a tool keeps its instructions in a form a person can read and change. Understanding one lets you adjust how software runs without touching any actual program code.

⚡ Quick Facts

File Extension.yml and .yaml
LanguageYAML, YAML Ain't Markup Language
CategoryConfiguration and data
FormatPlain text, human-readable
StructureIndentation with spaces
CommentsStart with the # symbol
MIME Typeapplication/yaml
Relationship to JSONA superset of it
Common InDocker, Kubernetes, CI and CD
Related Extensions.yaml, .json, .toml, .xml

🔤 YML vs YAML

A question that trips up almost everyone new to the format is whether .yml and .yaml are different. The short answer is no.

💡 They are the same format: Both extensions hold identical YAML content and every tool reads them the same way. The only difference is the spelling of the extension itself, with nothing changed inside the file.

The two spellings are a quirk of history. Early systems limited file extensions to three characters, so .yml was born as a fit for that rule. Those limits are long gone, and the official YAML project now prefers the fuller .yaml to match the name, yet .yml stayed popular and is still everywhere.

Point.yml.yaml
Same content yes yes
Read the same yes yes
Official preference older newer

One caveat worth knowing is that a few tools insist on an exact filename, such as a Docker Compose file or a GitLab pipeline file. In those cases you match the name the tool expects rather than swapping the spelling freely.

📐 What YAML Looks Like

The best way to understand a YML file is to see one. YAML reads almost like a plain list, with a colon separating each setting from its value and indentation showing what belongs where.

# a small example of YAML
name: Univik App
version: 2.1
settings:
  theme: dark
  cache: true
features:
  - search
  - export
  - sharing

Three ideas cover most of what you see. A pair like theme: dark is a key and its value. An indented block groups related settings under a heading. A line that starts with a dash is one item in a list. That is nearly the whole language at a glance.

⚠️ Indentation is not decoration: In YAML the spaces at the start of a line carry meaning, showing what sits inside what. Getting them wrong changes the structure, which is why tabs are banned and spaces are the rule.
Almost all of YAML is three simple shapes Key and value theme: dark one setting, a name and its value Indented block settings:   cache: true groups settings under a heading List item - search - export a dash marks each item in a list indentation with spaces shows what belongs inside what

Beyond those basics, YAML has a few handy extras. A block written with | keeps line breaks in a long piece of text, while > folds the lines into one. An anchor, marked with &, lets you name a chunk and reuse it later with *, saving repetition. And a line of three dashes, ---, separates several documents held in one file.

Handy extras once you know the basics Reuse a block &name defines *name reuses anchors and aliases Long text | keeps breaks > folds to one block scalars Many in one --- separates documents the same features every YAML tool understands

📂 How to Open a YML File

Because a YML file is plain text, opening one is easy and needs nothing special. A few options suit different needs.

1

Any text editor

Notepad, TextEdit or a similar built-in editor opens a YML file instantly for a quick read.

2

A code editor

An editor such as VS Code adds colour and highlights mistakes, making a YML file far easier to follow.

3

An online viewer

Univik's viewer shows the file in a browser with its structure laid out, with nothing to install.

💡 Tip: Creating one is just as simple, since a new plain-text file saved with a .yml extension is all it takes. For anything longer than a few lines, a code editor pays off. The colouring alone makes the keys, values and indentation stand out, so errors are easier to spot before they cause trouble.

✏️ Editing YML Safely

Changing a YML file is straightforward, but the same indentation that makes YAML readable also makes it fussy. A few habits keep edits trouble-free.

Do

  • Use spaces to indent, keeping them even
  • Copy the existing style, of the file
  • Check it with a validator, after editing
  • Keep a backup, before big changes

Avoid

  • Mixing tabs and spaces, a frequent cause of errors
  • Uneven indentation, that shifts the structure
  • Forgetting the colon, after a key
  • Editing live settings, without a copy

✅ Validating a YML File

Since a small slip in spacing can break a YAML file, checking one before you rely on it saves a lot of grief. There are three easy ways to do it.

An online checkerPaste the file into a web validator such as YAML Lint, which flags the exact line where something is off. Nothing to install and instant feedback.
A command-line linterThe yamllint tool checks a file from the terminal and reports both errors and untidy style, handy inside an automated pipeline.
In PythonThe PyYAML library reads a file with yaml.safe_load, which fails clearly if the file is malformed, so a short script can confirm it parses.
⚠️ Mind the truthy trap: YAML can read bare words like yes, no, on and off as true or false rather than as text. If you mean the word, wrap it in quotes, since this quirk catches people out in real config files.

🎯 Where YAML Is Used

YAML turns up all over modern software, usually wherever a tool needs settings that a person will read and adjust.

Containers

Docker Compose

A compose file describes the containers that make up an app and how they connect.

Kubernetes

Kubernetes

Deployments and services are defined in YAML, spelling out what should run where.

Pipelines

CI and CD

Tools like GitHub Actions read a YAML workflow to build and test a project automatically.

Automation

Ansible

Ansible playbooks are YAML files that describe the steps to set up and manage servers.

⚔️ YAML vs JSON

YAML and JSON both store structured data, and YAML can do everything JSON does. They suit slightly different jobs, and knowing when each fits helps.

PointYAMLJSON
Easy for people to read very~ less so
Supports comments yes no
Uses braces and brackets no yes
Common for data exchange~ sometimes widely

The rule of thumb is simple. YAML shines for settings a person edits by hand, thanks to its clean look and comments. JSON is the common choice when programs pass data to each other. Since YAML is a superset of JSON, you can even paste JSON into a YML file and it remains valid.

🔄 Converting YML Files

Sometimes you need the same data in another shape, most often as JSON for a program to consume, or the other way around. Because the two formats map onto each other, converting is clean.

1

Pick the target

Decide what you need, usually JSON for machines to read, and keep the original YML as your editable copy.

2

Run the conversion

A converter such as Univik's turns the YML into the format you chose while preserving the data inside.

3

Check the result

Glance over the output to confirm the values and structure carried across as you expected.

💡 Two-way street: Conversion works both directions. You can turn a YML file into JSON when a program needs it, or turn JSON into YAML when you want something friendlier to read and edit by hand.

🔀 Related Formats

YAML sits among the configuration and data formats you meet alongside it.

.yamlThe same YAML format under its fuller extension, the spelling the official project prefers.
.jsonA data format that programs favour for exchange, which YAML can fully represent.
.tomlAnother readable configuration format, built around clear sections and simple pairs.
.xmlAn older, tag-based format for structured data, wordier than YAML but still widespread.
.iniA plain, long-standing settings format of simple sections and key equals value lines.

❓ Frequently Asked Questions

A YML file is plain text, so you can open it in any text editor, such as Notepad on Windows or TextEdit on a Mac. For a clearer view, a code editor like VS Code adds colour and flags mistakes in the indentation. You can also use an online viewer, such as Univik's, which shows the file in a browser with its structure laid out and nothing to install.

A YML file is a file written in YAML, a human-readable language for storing settings and structured data. It uses the .yml extension and is plain text, so a person can open and read it easily. YAML relies on indentation rather than brackets to show structure, and it is used across modern tools as a clear, editable configuration format that keeps settings simple to follow.

Yes. The .yml and .yaml extensions refer to exactly the same format, and every tool reads them the same way. The only difference is the spelling of the extension. The shorter .yml comes from old systems that limited extensions to three characters, while .yaml is the fuller spelling the official YAML project now prefers. The content inside the file is identical either way.

YAML stands for YAML Ain't Markup Language, a recursive acronym that pokes fun at itself while making a point. The name stresses that YAML is meant for data and configuration, not for marking up documents the way languages like HTML or XML do. It was originally read as Yet Another Markup Language before the current, more accurate meaning took over.

Open it in a text or code editor, make your change, and save. The one thing to watch is indentation, since YAML uses the spaces at the start of a line to show structure. Keep the spacing even, follow the style already in the file, and use spaces rather than tabs. After editing, running the file through a validator catches any mistakes before they cause a problem.

In YAML, the spaces at the start of a line are not just for looks, they show what belongs inside what. A setting indented under a heading is treated as part of that heading. If the indentation is uneven or mixes tabs with spaces, the structure changes or the file fails to parse. This is why spaces are the rule and tabs are not allowed.

Both store structured data, and YAML can express everything JSON can, since YAML is a superset of JSON. The differences are practical. YAML is easier for people to read and edit, and it allows comments, which makes it popular for settings. JSON uses braces and brackets and is the common choice when programs exchange data. You can convert freely between the two.

Yes, and the conversion is clean because YAML and JSON map onto each other. A converter, such as Univik's, turns a YML file into JSON when a program needs that format, keeping the data intact. It also works the other way, turning JSON into YAML when you want something friendlier to read and edit by hand. Checking the output afterwards confirms everything carried across.

Yes. A YML file is plain text that holds settings and data, not a program, so opening one to read it cannot run anything or harm your computer. The usual sensible care applies to any file from an unknown source, but the format itself carries no special risk. You can open and read a YML file freely in any editor or viewer.

The most common cause is indentation. Mixing tabs and spaces, or lining things up unevenly, changes the structure and breaks the file. Other frequent slips are a missing colon after a key, or a value that needs quotes but does not have them. Running the file through a YAML validator points to the exact line, which makes these small mistakes quick to fix.

YAML is a favourite in modern development and operations. Docker Compose describes an app's containers in a compose file, Kubernetes defines deployments and services in YAML, and tools like GitHub Actions and GitLab read YAML to build and test projects automatically. Ansible uses YAML playbooks to set up servers. Wherever a tool needs readable, editable settings, YAML tends to be the choice.

No. YAML does not allow tab characters for indentation, and using them causes errors. The rule is to indent with spaces only, keeping the number of spaces consistent through the file. Most code editors can be set to insert spaces when you press the Tab key, which makes this easy to follow without thinking about it and avoids one of the most common YAML mistakes.

You have three easy options. Paste the file into an online checker such as YAML Lint, which points to the exact line of any problem. Run the yamllint tool from a terminal, which reports errors and style issues and fits inside an automated pipeline. Or in Python, load the file with PyYAML's yaml.safe_load, which fails clearly when the file is malformed. Any of these confirms the file is sound before you use it.

The usual way is the PyYAML library. Install it, then call yaml.safe_load on the file's contents, which turns the YAML into ordinary Python dictionaries and lists you can work with. The safe_load version is preferred because it will not run arbitrary code hidden in a file. Writing YAML back out is just as simple with yaml.dump, making PyYAML the standard tool for the job.

They are YAML's way of reusing content without repeating it. An anchor, marked with an ampersand, gives a name to a block of settings. An alias, marked with an asterisk, then points back to that block wherever you need the same values again. This keeps a file shorter and easier to maintain, though referring to an anchor that does not exist will cause a parsing error.

📝 Summary

A YML file is a plain-text file written in YAML, a human-readable language for storing settings and structured data. It uses the .yml extension, which is identical to .yaml, the two being the same format under different spellings. YAML uses indentation with spaces rather than brackets to show structure, supports comments starting with #, and is a superset of JSON. You open a YML file in any text editor, a code editor like VS Code for clearer highlighting, or an online viewer. The format is everywhere in modern development, from Docker Compose and Kubernetes to CI and CD workflows and Ansible playbooks. Its main gotcha is indentation, since spaces carry meaning and tabs are not allowed, so a validator helps catch mistakes. Because YAML and JSON map onto each other, converting a YML file to JSON and back is clean and reliable.