Runs 100% in your browser — nothing is uploaded
Formatters & Minifiers

YAML Formatter / Validator

Format, validate, and reindent YAML with precise error locations — powered by js-yaml, in your browser.

YAML Formatter / Validator
Client-side

About this tool

The YAML Formatter & Validator parses your YAML and re-serializes it with consistent indentation, catching syntax errors before they break a Kubernetes manifest, Docker Compose file, or GitHub Actions workflow. Paste any YAML document and get back cleanly formatted output, or a precise error pointing to the exact line and column where parsing failed.

YAML's whitespace-sensitive syntax is notoriously easy to get subtly wrong — a misaligned list item, a tab where a space was expected, or an unclosed flow-style mapping can silently produce a different structure than intended, or fail outright. This tool uses js-yaml, the same YAML 1.2 parser used by countless Node.js tools, running entirely client-side. When your YAML is invalid, the error message includes the reason and the exact mark (line and column) where the parser stopped, mirroring what you'd see from a command-line linter.

You can choose 2-space or 4-space indentation for the reformatted output, and control the maximum line width (80, 120, or unlimited) to control how aggressively long scalars and flow collections get wrapped. Because everything runs in your browser with zero network requests, this tool is safe to use on YAML containing secrets, internal hostnames, or unpublished configuration — nothing is transmitted anywhere. Common uses: validating a Kubernetes manifest before applying it, cleaning up a hand-edited docker-compose.yml, normalizing indentation across a team's CI config files, or debugging a "bad indentation" error from a YAML-consuming tool.

FAQ

Does this tool send my YAML to a server?
No. Parsing and formatting run entirely in JavaScript inside your browser tab using the js-yaml library. Open your browser's Network panel while using it — you will see zero outbound requests.
Why does it say my YAML is invalid when it looks fine?
The most common cause is mixing tabs and spaces for indentation — YAML requires spaces only. Other frequent issues: inconsistent indentation between sibling list items, an unquoted string that starts with a special character, or an unclosed flow-style collection. The error message shows the exact line and column where the parser detected the problem.
Will formatting change the meaning of my YAML?
No. The tool parses your YAML into a data structure and re-serializes it — the resulting document represents the same data, just with normalized indentation and style. Comments are not preserved, since js-yaml's parser does not retain them.
What is the line width option for?
It controls how the formatter wraps long scalar values and flow-style collections. 80 and 120 match common editor line-length conventions; choosing "Unlimited" keeps every value on a single line regardless of length.
Can I convert the formatted YAML to JSON?
Yes — use the YAML to JSON tool for that conversion. This formatter is specifically for reformatting and validating YAML while keeping it as YAML.