YAML Formatter and Validator

Format, indent, and validate YAML in your browser. Catch parse errors with line and column info.

About YAML Formatter

Paste YAML configuration and reformat it with a consistent indent, or switch to validation mode to confirm the document parses and inspect it as JSON. Errors point to the exact line and column reported by the parser.

YAML 1.2 (yaml.org) is whitespace sensitive, so a single misaligned key can change the meaning of a document or break parsing entirely. This tool runs the same parser used by most Node and Python tooling (the libyaml-compatible js-yaml) and re-emits the document with a uniform indent of 2, 4, or 8 spaces. Line width is capped at 120 to keep configs reviewable in pull requests.

When parsing fails, the error block shows the reason from the parser along with the line and column where the failure was detected. That is usually the most useful signal for fixing tab vs. space mistakes, unquoted special characters, and stray colons inside flow scalars. The validate mode is helpful when you want to confirm a Kubernetes manifest, GitHub Actions workflow, or docker-compose file is well formed without changing the original.

Validate mode also renders the parsed result as JSON so you can sanity check how flow style, anchors, and references collapse into plain data. Aliases are resolved during parsing, and the JSON view shows the expanded result. The original YAML is never modified.

How to use the YAML Formatter
  1. 1

    Paste or upload

    Drop YAML into the editor or upload a .yaml file. The Load Example button fills the editor with a small valid sample.

  2. 2

    Pick a mode

    Format rewrites the document with your chosen indent. Validate parses without re-emitting and shows the result as JSON.

  3. 3

    Copy or download

    Copy the output to the clipboard or download a .yaml or .json file. Errors include the line and column from the parser.

Common use cases

Tidy Kubernetes manifests

Reformat manifests after hand edits so every resource uses a consistent 2 space indent before opening a pull request.

Debug GitHub Actions workflows

When a workflow refuses to start, run it through the validator to find the exact line where the parser stops.

Convert YAML to JSON

Use validate mode to read YAML and copy the parsed JSON into a tool that only accepts JSON input.

Normalize docker-compose files

Apply uniform indentation and line width across service definitions for cleaner diffs in version control.

Frequently asked questions
Is my YAML uploaded anywhere?

No. Parsing, formatting, and validation all run in your browser using js-yaml. Nothing is uploaded, logged, or transmitted to a server.

Which YAML version is supported?

The parser targets YAML 1.2, which is the version published at yaml.org and used by most modern tools. Anchors, aliases, flow style, and block style are all handled.

Why does the parser reject tabs?

YAML 1.2 forbids tab characters for indentation. Replace tabs with spaces. Most editors offer a convert tabs to spaces command for this.

Can I preserve comments when formatting?

No. The format step parses YAML into a data structure and re-emits it, which drops comments. Use the validate tab if you only need to check syntax without losing comments.

What does the line and column number refer to?

It points to where the parser stopped, which is usually at or just after the actual mistake. Look a line or two above the reported position if the error message mentions an unexpected token.

developerformattervalidatorconverter