YAML Formatter
Validate and format YAML, convert YAML to JSON, or convert JSON to YAML — all processed locally.
Last updated:
Validate, format and convert YAML
This YAML formatter checks that your YAML is valid and rewrites it with clean, consistent indentation. It can also convert YAML to JSON and JSON to YAML. Everything is processed locally in your browser.
How to use it
- Choose a tab: Validate / Format, YAML → JSON or JSON → YAML. An example is filled in for each.
- Paste your own content into the input box.
- Click the button: Format YAML, Convert to JSON or Convert to YAML.
- Read the output and click Copy.
How it works
The tool parses your input with the js-yaml library. If parsing fails, the error message is shown in red. If it succeeds, the data is written out again, which is what produces the formatting.
| Tab | Output |
|---|---|
| Validate / Format | YAML with 2-space indentation and no line wrapping |
| YAML → JSON | JSON indented with 2 spaces |
| JSON → YAML | YAML with 2-space indentation |
Assumptions and limits
- Comments are not kept. The tool re-creates the YAML from the data, so comments in the input are dropped.
- Key order is kept, but quoting and list style may change to the library's defaults.
- Several YAML documents separated by
---are supported. In YAML → JSON they become an array. - The indentation is fixed at 2 spaces. There is no option to change it.
- Switching tabs replaces the input with that tab's example.
Frequently asked questions
Will formatting remove my comments?
Yes. Comments are not part of the parsed data, so they do not appear in the output. Copy them back by hand if you need them.
Does it work with multi-document YAML?
Yes. Format mode keeps the documents apart with ---. YAML → JSON returns a single value for one document, or an array for several.
What happens if my JSON is invalid?
In JSON → YAML mode you get an "Invalid JSON" message with the parser's reason, and no output.
Related Developer Tools
Browse all tools from the same category.
Domain Authority Checker
Check Moz authority, page authority, spam score, and backlink metrics
Open toolSEO Audit Tool
Audit a website URL for technical SEO, metadata, headings, broken internal links, hreflang, canonical and X-Robots-Tag checks, with report exports
Open toolShowing 1-2 of 49