Skip to content
toolgrid

No tool found. Try another word.

YAML Formatter

Format and validate YAML: consistent indentation, optional sorted keys and line wrapping, and clear errors with line and column. Supports multiple documents.

Runs in your browser. What you enter is kept for 30 days to improve Toolgrid, then deleted.

How to use the YAML Formatter

  1. 1 Paste your YAML, for example a Docker Compose, Kubernetes or CI file.
  2. 2 Choose the indentation, whether to sort keys and the line width.
  3. 3 Copy the formatted YAML or download it.

About the YAML Formatter

YAML is everywhere in configuration: Docker Compose, Kubernetes manifests, GitHub Actions, GitLab CI, Ansible and OpenAPI. Because indentation defines the structure, a single misplaced space can change the meaning or break the file. The formatter reads your YAML and writes it out again with consistent indentation and style.

Formatting is also validation: if the YAML can't be parsed, you see the parser's message with the line and column. Inline lists and maps ([a, b] and {key: value}) are rewritten as block style, quotes are only kept where they are needed, and documents separated by --- are formatted one by one.

Note that comments are lost when YAML is parsed and written again, because they aren't part of the data. Anchors and aliases (&name and *name) are expanded. Keep your original file if comments matter, and use the formatted version to check or clean up the structure.

Frequently asked questions

Why are my comments gone?

The formatter parses YAML into data and writes it back; comments aren't part of the data, so they can't be kept. Use it to check structure, or format a copy.

Tabs or spaces in YAML?

Spaces only: YAML doesn't allow tabs for indentation. Two spaces per level is the most common style.

Does it validate Kubernetes or Compose schemas?

No, it checks YAML syntax, not whether the keys are valid for a particular tool.

Why did "no" become false?

It didn't in YAML 1.2, which this tool uses: only true and false are booleans. Older YAML 1.1 parsers treat yes, no, on and off as booleans, so quote them to be safe.