YAML Validator & Formatter
Validate, pretty-print, and convert YAML to JSON or JSON to YAML in your browser. Your work stays on this device whenever possible.
How to use YAML Validator & Formatter
- Paste your configuration into the input editor, or press "Load sample" to insert a Kubernetes-style deployment manifest.
- Pick a "Mode": "Format / Validate", "Convert to JSON" or "Convert from JSON".
- Choose an "Indentation" of 2 spaces or 4 spaces, and tick "Sort keys alphabetically" for stable output.
- Press "Format / Convert"; parser errors show in the status line and the result box stays hidden.
- Use "Copy" or "Download file"; the saved file uses a .yaml or .json extension depending on the mode.
Worked example
Set Mode to "Convert from JSON", indentation to 2 spaces and paste {"name":"api","ports":[80,443],"debug":false}. The result box shows "name: api", then "ports:" followed by two indented list lines, "- 80" and "- 443", and finally "debug: false". The status line confirms conversion succeeded, and "Download file" saves the formatted configuration.
When to use this tool
- Validating a Kubernetes manifest before applying it.
- Turning an OpenAPI fragment into a brace-delimited object for a client that only reads that format.
- Sorting keys in two config files so a diff shows only real changes.
Important limitations
Valid YAML requires consistent indentation (using spaces rather than tabs). Tab characters and improper indentation levels are detected and highlighted with line and column numbers.
Comparing alternatives
Other options for yaml validator & formatter include YAML Lint, Online YAML Tools, json2yaml.
ToolkitPoint is not affiliated with those services.
Frequently asked questions
Which parser does the formatter use?
A standards-compliant parser library fetched from a public CDN when you press the button. If it cannot load, a small built-in reader takes over, which understands only flat key-value lines and one-level lists. Nested maps, multi-line strings and anchors are not handled by that fallback.
Are comments preserved?
No. The text is parsed into a data tree and serialised again, so comments, blank lines, anchors and the original quoting style are lost. Keep the source file if comments matter.
Does conversion keep value types?
Values follow standard schema rules, so true, 3, 1.5 and null become native booleans, numbers and nulls. An unquoted 1.10 is read as the number 1.1 and loses its trailing zero, so quote version strings.
Can I convert a file with several documents?
The loader expects a single document, so a stream holding several sections separated by three dashes reports an error. Split the file into individual documents and format each one.
What does sorting keys affect?
Object keys are sorted alphabetically at every depth, but array items keep their original order. The option is applied for all three modes, which is handy for diffing two versions of the same configuration.