yaml formatter

How to use the yaml formatter

  1. Paste the YAML you want to validate or format — a green 'Valid YAML' badge appears when parsing succeeds.
  2. If there's a syntax error, the tool shows the exact line and column (tabs vs spaces is the most common culprit).
  3. Pick indent (2 or 4 spaces), sort keys alphabetically, or set a flow level to switch inline at a given nest depth.
  4. Switch the output to JSON to convert YAML configs for APIs that only accept JSON.

When to use it

Use it when editing GitHub Actions workflows, Kubernetes manifests, Docker Compose files, Jekyll front-matter, or OpenAPI specs. The strict YAML 1.2 parser rejects the subtle mistakes — tab indentation, unquoted special keys, Norway problem (`no` → false) — that break deployments. Alternative: `yamllint` on the command line is stricter but slower; this tool is faster for one-off fixes.

Frequently asked questions

What is a YAML formatter?
A tool that validates YAML syntax and re-emits the document with consistent indentation, quoting, and flow style. This one uses js-yaml — the same parser used by npm, Jekyll, Hugo, and GitHub Actions.
Why does my YAML keep showing as invalid?
The top three causes: tabs instead of spaces for indentation (YAML forbids tabs), unquoted strings that look like booleans (`yes`, `no`, `on`, `off`), and trailing colons without values on keys that aren't empty mappings.
Can I convert YAML to JSON here?
Yes. Change the output format to JSON — the tool parses the YAML into a native object and serializes it as indented JSON.
Does the YAML formatter support anchors and aliases?
It parses them correctly, but by default the dumped output expands references (no repeated `&ref` / `*ref`). If you need to preserve them, paste the output back into your editor and re-add the anchors manually.
What is the flow level option?
YAML has two styles: block (indented, Python-like) and flow (inline with braces and brackets). Flow level -1 uses block everywhere; level 2 switches to flow style two levels deep. Useful for compact config files.
Will sort keys break my CI config?
It can — some tools rely on key order (GitHub Actions jobs run in declaration order). Enable sort only for configs where order doesn't matter, like Kubernetes manifests or application YAML.

Related tools

  • Free JSON / YAML Converter
  • Free JSON Formatter
  • Free XML Formatter & Validator
  • Free HTML Formatter & Beautifier

Last updated: 2026-04-24