YAML Viewer & Formatter
Validate and pretty-print YAML, optionally sort keys, or view it as JSON, locally.
Validate messy YAML and normalize its indentation
This tool parses YAML and re-emits it with consistent two-space indentation, catching syntax errors like a bad indent level or an unclosed quote along the way. A Sort keys checkbox reorders each mapping alphabetically, and an As JSON view shows the same parsed data as indented JSON. It's built for the moment a YAML config from a teammate or a CI file won't parse and you need to find exactly where, or you just want it as JSON. Parsing runs on a JavaScript YAML library in your browser tab.
How to use the YAML Viewer & Formatter
- Paste YAML into the left panel, or click Example to load a sample document.
- Toggle Sort keys on to reorder each mapping's keys alphabetically in the output.
- Switch to As JSON to view the same parsed data as indented JSON instead.
- Check the input panel's footer for a parse error if the output panel stays empty.
- Copy the result or use the send-to menu to pass it into another tool.
Sort keys reorders keys within every mapping in the document, including nested ones, but leaves list item order untouched, since YAML sequences are ordered data rather than named fields.
The As JSON view uses the same parsed value as the formatted YAML output, so any type YAML represents, including null, dates parsed from unquoted timestamps, and multi-line block scalars, converts to its JSON equivalent.
Frequently asked questions
- Why does my YAML fail to format here?
- The formatter parses your YAML with a standard YAML library before re-emitting it, so any syntax error, such as inconsistent indentation or an unterminated quoted string, is reported instead of a partial result.
- Does sorting keys change list order too?
- No, Sort keys only reorders the named keys inside each mapping alphabetically; items inside YAML sequences (lists) keep their original order since that order is meaningful data, not just labeling.
- Can I use this to check if my YAML is valid?
- Yes, pasting invalid YAML surfaces a parse error in the input panel's footer describing the problem, which is a fast way to confirm a config file or CI pipeline definition is syntactically correct.
- Is my YAML file uploaded when I view or format it?
- No, parsing, formatting and the JSON view all run locally using the js-yaml library inside your browser tab, so a config file with internal service names or paths never leaves your device.