Online YAML validator

Validate your YAML configuration online and get detailed error messages

YAML is valid!

What is YAML?

YAML (YAML Ain't Markup Language) is a human-readable data serialization language used for configuration files and data storage or exchange. It uses a minimal syntax that relies on indentation to define the structure of the data.

The official recommended extension for YAML files is .yaml.

The YAML syntax

  • Indentation: YAML uses indentation to represent data structure, similar to how Python uses indentation. Indentation is used to indicate nesting.
  • Scalars: Scalars are simple data types like strings, numbers, and booleans. They can be written as plain scalars (unquoted), single-quoted scalars, or double-quoted scalars.
  • Lists: Lists are ordered collections of items. In YAML, lists are represented using dashes - followed by a space for each item.
  • Dictionaries (Mappings): Dictionaries, also known as mappings or associative arrays, are collections of key-value pairs. In YAML, mappings are represented using key-value pairs separated by a colon :, with each pair on a new line and the key and value separated by whitespace.
  • Comments: Comments in YAML start with the hash symbol #.
  • Anchors and Aliases: YAML allows the reuse of data using anchors & and aliases *. An anchor is defined using the & symbol, and an alias refers back to that anchor using the * symbol.
  • Multi-line Strings: YAML supports multi-line strings. Multi-line strings can be represented using the pipe| character, which preserves newlines, or the greater than > character, which folds newlines into spaces.

Common errors

Here is a list of common errors you might encounter when writing YAML:

  • Indentation Errors: YAML relies heavily on indentation to denote structure. Mixing spaces and tabs for indentation or inconsistent indentation levels can lead to syntax errors.
  • Missing or Misplaced Colon: In mappings (key-value pairs), a colon separates the key from the value. Forgetting to include the colon or placing it incorrectly can cause parsing errors.
  • Incorrect Quoting: Strings that contain special characters, such as colons or spaces, need to be properly quoted. Forgetting to quote strings or using the wrong type of quotes (single vs. double) can lead to interpretation errors.
  • Improper List Formatting: Lists are denoted by using a dash (-) followed by a space for each item. Forgetting the space after the dash or mixing up list item formats can cause parsing issues.