Skip to main content
Tools

YAML Formatter

Validate and beautify YAML: consistent indentation and quotes, comments kept, and syntax errors pinned to a line and column.

Indent
Quotes

0 characters · 1 line

How to use

  1. Paste YAML into “Input YAML”, or click “Example” to try it.
  2. The result appears instantly. Syntax errors show the line, column and reason (such as tab indentation or a duplicate key).
  3. Choose the indent, quote style and line width, or turn on “Expand one-line [ ] and { } into blocks”.
  4. Click “Copy” or “Download” to grab the tidy YAML.

FAQ

Is my YAML uploaded?

No. Validation and formatting happen in your browser and your data never leaves your device. The YAML library is downloaded from this site the first time you format, and is not needed again after that.

Are comments kept?

Yes. Inline and full-line comments stay where they were, and anchors (&), aliases (*), merge keys (<<) and tags (!!) are kept as written. A few comments in unusual places (inside [ ], for example) may move to a neighboring line.

Can formatting change my data?

Values stay the same. Numbers keep their exact spelling, so 0755, 0x1F, 1.0 and +12 are not rewritten as 755, 0x1f, 1 and 12. That matters because YAML 1.1 reads 0755 as octal (Ansible file modes rely on this). Switching to double or single quotes only changes how strings are written, not their content; strings with tabs or other control characters stay double-quoted.

Why are tabs not allowed for indentation?

The YAML specification only allows spaces for indentation, so tabs cause a parse error. The tool points to the first tab; after you fix it, the next error is shown.

Can it handle several documents separated by ---?

Yes. Each document is formatted on its own, and the --- and ... markers are kept. The number of documents is shown below the result.

What does “Line width” do?

By default nothing is wrapped. With 80 or 120 characters, long strings are folded over several lines. Under YAML’s rules each fold reads back as a single space, so the content does not change.

Keyboard shortcuts

/
Search tools (on a tool page, goes to the homepage search)
?
Show this help
Esc
Close a dialog
Ctrl / ⌘Enter
Run the tool's main action (where supported)

While you type in a text field, / and ? are typed as usual.