Skip to content

YAML Formatter

Validate and tidy YAML with this YAML Formatter. Paste configuration, Kubernetes manifests, CI pipelines or front matter and the tool parses the document to catch syntax errors, then normalizes spacing after colons and list dashes and inside flow collections like [a, b] and { x: 1 }. Your indentation, comments, quotes and block scalars stay as written, so DevOps engineers and developers get cleaner files safely.

Reset

Frequently asked questions

What does the YAML Formatter change?

It normalizes spacing: one space after a mapping colon, one space after a list dash, a space after commas in flow sequences and spaces inside flow mapping braces. Multiple spaces before a comment are reduced to one.

Does it re-indent my YAML?

No, it keeps the indentation you wrote, because indentation defines structure in YAML. A nested block indented by four spaces stays at four spaces.

Does it validate the document?

Yes, the document is parsed first and errors are reported with a message and the line, for example when a colon in a flow mapping is not followed by a space. Fix the reported line and format again.

Are comments kept?

Yes, full line comments and trailing comments are preserved. A trailing comment keeps a single space between the value and its # sign.

What happens to block scalars?

Literal and folded block scalars introduced with | or > are copied exactly, including the spacing inside their lines. Every line indented deeper than the key belongs to the scalar and is left alone.

Are quoted strings changed?

No, single and double quoted strings and the spaces inside them are kept. Quotes are never added or removed, so values keep their type.

Are line endings changed?

Yes, Windows CRLF and old Mac CR line endings are converted to LF. YAML parsers treat both the same, so the data does not change.

Can it format several documents in one file?

No, input with several documents separated by --- is rejected with the message Multiple documents are not supported. Format each document on its own and join them again afterward.

Why is the result wrapped in a yaml code fence?

The output is returned as a Markdown code block marked yaml, so it renders highlighted in Markdown. Copy the lines between the fences into your .yaml or .yml file.

How large can my file be?

Up to 5 MB per run; larger input is rejected with a message. An empty input returns an empty result, and the output matches the YAML option of the Code Formatter.

About OneClick Pro

OneClick Pro is a free collection of more than 150 web tools for everyday work: converting images and units, formatting and validating code, checking domains and SEO, and working with text, dates and numbers. Every tool runs without registration or subscription, and what you enter is only used to calculate your result and is never stored. Use it as a quick toolbox for one-off tasks, or bookmark the tools you rely on every day.