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.

YAML input
YAML output

How to use YAML Formatter

  1. 1
    Paste 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.

  2. 2
    Choose 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.

  3. 3
    Set indent size

    Choose 2 or 4 spaces for YAML indentation. The output updates automatically.

  4. 4
    Review 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.

  5. 5
    Copy 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