YAML Formatter

Paste YAML, like a Kubernetes manifest, GitHub Actions workflow, or docker-compose file, to normalize its indentation, or switch modes to convert it to JSON or convert JSON back into YAML. Invalid YAML produces a clear, specific error message instead of a silent failure. Parsing runs with js-yaml entirely in your browser.

PrivateFreeWorks offline

Reviewed by Vincenzo Manto, Founder & Lead Developer · Last updated September 27, 2026

How it works

  1. 1

    Paste your YAML or drop a .yaml/.yml file into the input box.

  2. 2

    Choose Format YAML to normalize indentation, or switch to a YAML ↔ JSON conversion mode.

  3. 3

    Invalid input shows a specific parser error instead of a blank result.

  4. 4

    Copy the output or download it as a file.

Consistent YAML for config-heavy workflows

YAML is the backbone of Kubernetes manifests, CI/CD pipelines, and countless configuration files, but hand-edited YAML often ends up with mixed indentation or inconsistent list styles. This formatter re-serializes your document with clean, consistent spacing, making diffs smaller and files easier to review across a team.

One tool for both YAML and JSON

Because YAML is a superset of JSON's data model, converting between them is a common need when moving configuration between tools that expect one format or the other. This tool handles both directions with the same underlying js-yaml parser, so the conversion is accurate and handles YAML-specific features like anchors, multi-line strings, and flow collections correctly.

Frequently asked questions

Does this tool send my YAML to a server?

No. Parsing and conversion run with the js-yaml library entirely inside your browser, so nothing is uploaded.

What does 'Format YAML' actually change?

It re-parses your YAML into a data structure and re-serializes it with consistent indentation and formatting, which is useful for cleaning up inconsistently indented files from different editors or tools.

Can it convert a YAML file to JSON, and back?

Yes. Switch to YAML → JSON to get a pretty-printed JSON version of your YAML, or JSON → YAML to convert JSON data into YAML syntax.

What happens if my YAML has a syntax error?

The output panel shows the exact error from the YAML parser (such as a bad indentation or an unclosed flow sequence) instead of silently failing or producing wrong output.

Does formatting preserve comments in my YAML?

No. Because formatting works by parsing YAML into a data structure and re-serializing it, comments (which aren't part of the data model) are not preserved. Use it for data files without comments, or for pure YAML ↔ JSON conversion.

Related tools