Handytool
DeveloperFreeRuns locally

YAML formatter

Format and validate YAML, or convert between YAML and JSON — privately in your browser.

.yaml.yml
Indent
YAML or JSON input
0 lines0 bytes
Output
0 lines0 bytes

About the YAML formatter

Handytool's YAML formatter normalises YAML indentation, quote style, and key order using the standard js-yaml parser, and can also convert YAML to JSON or JSON back to YAML in one click. Useful for cleaning up Kubernetes manifests, GitHub Actions workflows, Helm values, and any config file that has drifted from a consistent style. The parser is the same one used by most JavaScript build tooling, so what validates here will validate in production.

YAML formatter features

  • 01

    Format and lint

    Parses your YAML, drops trailing whitespace, normalises indentation to 2 or 4 spaces, and re-emits it. Syntax errors are surfaced with the exact line and reason.

  • 02

    YAML ↔ JSON

    Convert YAML to JSON to feed it into a tool that only speaks JSON, or convert JSON back to YAML to make a config file human-friendly.

  • 03

    Preserves types

    Numbers, booleans, nulls, and dates round-trip correctly through the parser, so a YAML file that goes in as YAML 1.2 comes out the same way.

YAML formatter FAQ

Which YAML version does this support?
YAML 1.2 by default — the version most modern tools (Kubernetes, GitHub Actions, Docker Compose) use. The parser is js-yaml, the same library used by most JavaScript build tooling.
Will it preserve comments?
No. Standard YAML parsers don't preserve comments through a parse-then-dump round trip — that's a known limitation of every JavaScript YAML library, not specific to this tool. Format your file before adding important comments back.
What's the difference between formatting and converting?
Formatting keeps the file as YAML and just normalises whitespace, key order, and indentation. Converting changes the format entirely — YAML to JSON or vice versa.
Does this handle multi-document YAML?
The first document of a multi-document YAML file is parsed and re-emitted. To work with all documents, split them with --- and process each separately.

Related tools

Developer

Explore other tools

All tools