YAML Indentation and Structure/Two-space indentation

Use consistent spaces for nested levels.

Section: Indentation rules

Two-space indentation

yaml
yaml
app:
  name: Cheatsheet.today
  seo:
    enabled: true
Explanation

Two spaces is the most common convention and works well across teams.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Indentation rules
Mixed indentation example
Illustrate a broken file caused by inconsistent nesting.
OpenIn sheetyamlsame section
Sequence nested under a key
Indent list items under their parent key.
OpenIn sheetyamlsame section
Mappings inside a sequence
Represent a list of objects cleanly.
OpenIn sheetyamlsame section
Run yamllint with a custom config
Use a project-specific lint profile.
OpenIn sheetbash1 tag match
Reveal hidden whitespace
Print tabs and line endings to spot indentation issues.
OpenIn sheetbash1 tag match
Find tabs in YAML files
Locate tab characters that may break parsing.
OpenIn sheetbash1 tag match