YAML Formatter

Format and beautify YAML online, sort keys, change indentation and convert between YAML and JSON. Free, no sign-up, and everything runs privately in your browser.

How to use the YAML formatter

  1. Paste YAML or JSON, upload a file, or load the messy sample.
  2. Choose output: formatted YAML, pretty JSON or minified JSON; set indentation and options.
  3. Click Format. Use Use as input to chain conversions.
  4. Copy or download the result. Note: YAML comments are not preserved when re-serialising.

Input

Formatted output

Why format YAML?

Consistent formatting makes manifests easier to review: diffs show real changes instead of whitespace noise, and indentation mistakes become obvious. The formatter parses your input into data and writes it back out with uniform indentation and quoting. Because it understands structure, it can also sort keys alphabetically, compact deeply nested structures into flow style, and convert between YAML and JSON in either direction.

YAML and JSON conversion

Every JSON document is valid YAML, so you can paste JSON in and get YAML out — handy for turning API responses or kubectl get -o json output into readable manifests. Going the other way, the JSON outputs are useful for APIs and tools that only accept JSON, such as the Argo Server REST API. Multi-document YAML becomes a JSON array.

Things to know

  • Comments are not preserved, because they are not part of the data model. Keep a copy of commented files.
  • Anchors and aliases are expanded into plain values.
  • Values beginning with {{ are quoted automatically so Argo expressions stay valid.

Frequently asked questions

Is there a size limit?

Only your browser’s memory; files of several megabytes format comfortably.

Does it fix invalid YAML?

It reports the exact line and column of syntax errors so you can fix them, then formats the result.

Is my data private?

Yes. Nothing is uploaded; formatting runs locally.

More free tools