YAML Formatter
Format and validate YAML, or convert between YAML and JSON. Supports 2 and 4 space indentation. All processing is done locally in your browser using js-yaml — nothing is uploaded.
How to use YAML Formatter
- 1Paste your YAML or JSON
Enter your content in the input field. For YAML formatting, paste any valid YAML. For conversion, you can paste either YAML or JSON depending on the selected tab.
- 2Choose the operation
Select Format YAML to clean up and re-indent your YAML, YAML → JSON to convert to JSON format, or JSON → YAML to convert JSON to YAML syntax.
- 3Set indent size
Choose 2 or 4 spaces for YAML indentation. The output updates automatically.
- 4Review errors
If your YAML or JSON has a syntax error, a red error banner appears with the parse error message to help you locate the problem.
- 5Copy or download
Use the Copy button to copy the output, or Download to save the result as a .yaml or .json file.
Frequently Asked Questions
What is YAML and how is it different from JSON?
- YAML (YAML Ain't Markup Language) is a human-friendly data serialisation format. Unlike JSON, YAML uses indentation instead of braces and brackets, supports comments with #, and allows unquoted strings. YAML is a superset of JSON — all valid JSON is valid YAML. YAML is widely used for configuration files (Kubernetes, GitHub Actions, Docker Compose).
Can every YAML document be converted to JSON?
- Most YAML can be converted to JSON, but not all. YAML features that have no JSON equivalent include comments, anchors and aliases (&anchor / *alias), multi-document streams (---), and some special scalar types. The tool converts what it can and notes any unsupported features.
Does YAML formatting change my data?
- No. Formatting only changes whitespace and key ordering — it does not alter values, types, or structure. The formatted output represents the same data as the input.
Is my data sent to a server?
- No. All YAML parsing and formatting is done locally in your browser using the js-yaml library. Nothing is uploaded anywhere.
What YAML version is supported?
- The tool supports YAML 1.2 via the js-yaml library, which handles all common YAML constructs including multi-line strings, anchors, aliases, custom tags, and nested structures.
Related Tools
JSON Formatter
Clean, minify, and validate JSON data structures.
XML Formatter
Format, minify, and validate XML. Convert XML to JSON with one click. Supports custom indent sizes.
JSON ↔ CSV Converter
Convert JSON arrays to CSV and CSV back to JSON. Custom delimiter, header row control, and one-click download.
Base64
Encode and decode Base64 strings instantly.