About this tool
Format simple YAML, list keys, and convert YAML snippets to JSON.
A YAML formatter re-indents a YAML document to a consistent structure, reports every mapping key as a dotted path, and converts the same data to JSON. This one parses with the YAML 1.2 core schema — the tag-resolution rules in §10.2 of the spec, which recognise null, bool, int, float and str and nothing else — so `enabled: no` and `2024-01-01` stay strings instead of silently becoming a boolean or a date. It is for engineers cleaning up Kubernetes manifests, GitHub Actions workflows, Ansible playbooks and docker-compose files.
Open YAML Formatter on AltFTool — it loads instantly in your browser.
Paste a Kubernetes manifest, GitHub Actions workflow or docker-compose file into the YAML input box.
Pick an Indent width of 2 or 4 spaces, set "Fold long scalars at" to 80 columns, 120 columns or Never fold, and optionally tick "Sort mapping keys A–Z".
Switch between Formatted YAML, JSON and Key list — which shows each dotted Key path with its Type — then press Copy result.
Re-emit at 2 or 4 spaces, with sequences indented under their parent key.
Each mapping key is listed as a dotted path with its type and a value preview.
A parse failure names the line and column and the reason, instead of just failing.
Two. The YAML 1.2 spec only requires one or more spaces per block level, but 2 is the convention in Kubernetes manifests, GitHub Actions workflows, Ansible playbooks and docker-compose files, so it is the default here. Tabs are never allowed for indentation — the spec forbids them outright, which is the single most common reason a YAML file fails to parse.
Because this tool uses the YAML 1.2 core schema, where only the literal words `true` and `false` are booleans. YAML 1.1 treated `y`, `yes`, `no`, `on` and `off` as booleans too — the notorious 'Norway problem', where the country code `NO` becomes `false`. Quote the value as `"no"` if you need it to survive an older parser unchanged.
JSON is a subset of YAML: since YAML 1.2 every valid JSON document is also a valid YAML document, so you can paste JSON in and it will parse. The reverse is not true — YAML has comments, anchors, multiple documents in one stream and unquoted strings, none of which JSON allows, which is why converting YAML to JSON drops comments entirely.
It is reported as an error on the second occurrence. The YAML spec requires keys within a single mapping to be unique, and duplicates are a common source of silent bugs because many parsers just keep the last value. Rename or remove one of the two keys to format the document.