Skip to content
OnlineToolStudio

YAML Formatter

runs in your browserno sign-upfree

Format YAML with consistent indentation while keeping comments, anchors and multiple documents.

Valid YAML · formatted, comments kept

YAML259 chars
Formatted YAML

About this tool

This YAML formatter re-indents YAML consistently with 2 or 4 spaces and tidies spacing, while keeping your comments, anchors and aliases, quotes and every document in the file. The YAML is checked first, so any error is shown with its line and column.

How to use

  1. Paste your YAML into the YAML box.
  2. Choose an indent of 2 or 4 spaces.
  3. Copy the formatted YAML or download it as a .yaml file.

FAQ

Are my comments kept?

Yes. Comments stay next to the lines they belong to; only the indentation and spacing change.

Does formatting change my data?

No. Keys, values, quotes and the order of items stay the same. Short inline lists and maps written as [a, b] or {a: 1} stay inline, and long lines are not re-wrapped.

Can it format files with several documents?

Yes. Documents separated by --- are formatted one by one and stay separated.

Is my YAML uploaded?

No. Everything runs in your browser, so config files, secrets in environment variables and other data never leave your device. Your last input is saved only in this browser; press Clear to remove it.

Related tools

All tools