EN
My tools

YAML Formatter / Beautifier

Format YAML with consistent indentation: 2 or 4 spaces, sorted keys, quoting style, line width, block or flow style, anchors expanded. Multi-document.

Off: "key:" followed by "- item" at the same indentation (the style Kubernetes and Ansible docs often use).
My tools →
Advertisement

YAML that several people have edited ends up with mixed indentation, inline {…} and […] in some places and blocks in others, and inconsistent quoting. This formatter reads the YAML and writes it back in one consistent style: 2 or 4 spaces, block or flow collections, your choice of quotes, optional sorted keys and line wrapping. It handles files with several documents (---), and keeps CloudFormation and Ansible tags such as !Ref, !Sub and !vault. Errors are reported with their line and column.

How to use this tool

  1. Paste the YAML — a Kubernetes manifest, Docker Compose file, GitHub Actions workflow, CloudFormation template…
  2. Choose 2 or 4 spaces and whether list items are indented under their key.
  3. Pick block or flow style, the quote character and the wrap width.
  4. Optionally sort keys or expand anchors.
  5. Copy the formatted YAML — and copy back any comments you need, because they are removed.

Formula

parse (YAML 1.2 core schema) → data → write with one indentation, style and quoting

Because the YAML is parsed and written again, the result is equivalent data in a uniform style. Strings are quoted only when they would otherwise be read as something else (a number, a boolean, a null, or YAML syntax), unless "Quote every string" is ticked. Merge keys (<<) are kept, not applied. Comments and the original key order (when sorting) are not preserved.

Example

The sample Docker Compose file mixes 4- and 10-space indentation with inline mappings. Formatted with 2 spaces it becomes a uniform block: services: → web: with image: nginx:1.27, a ports: list of '80:80' and '443:443' (quoted, because YAML 1.1 parsers would read 80:80 as a number), restart: always, then db: with its environment as a nested mapping and volumes as a list, and finally volumes: with db-data: {}.

Frequently asked questions

Why did my comments disappear?

The formatter parses YAML into data and writes it out again, and comments are not part of the data. Keep a copy of commented files, or re-add the important comments after formatting.

Why are some values quoted?

Without quotes they would mean something else: 80:80 and 1e3 look like numbers, yes/no/on/off are booleans to YAML 1.1 tools, and values starting with * & ! { [ # are syntax. Quoting keeps them strings for every parser.

Is it safe for Kubernetes or GitHub Actions files?

Yes — the data is unchanged, only the layout. Check the result before committing, especially if you rely on comments or on a particular key order.

Is my YAML uploaded?

No. Formatting runs in your browser.

Sources

Last updated:

Cite or embed this tool
APA

kakaoCalc. (2026, November 8). YAML Formatter / Beautifier. https://kakao.mobile/tools/yaml-formatter/

MLA

“YAML Formatter / Beautifier.” kakaoCalc, 8 Nov. 2026, kakao.mobile/tools/yaml-formatter/.

Paste this code into your page. The widget runs in your visitors' browsers, shows no ads and keeps a link back to this page. Embedding terms

Advertisement