Developer Tools

YAML Formatter / Validator

Validate and format YAML with line-accurate errors, and convert YAML to JSON or JSON to YAML.

Check that YAML is valid, tidy its indentation, and convert between YAML and JSON, entirely in your browser. Working with the JSON side of a config? Use the JSON Formatter.

Your YAML never leaves your device. It is parsed and formatted entirely in your browser.
What do you want to do?
0 characters
Formatting keeps comments, anchors and quoting styles. YAML 1.2 rules apply, so values like yes and on are text, not booleans. Converting to JSON loses comments (JSON has none), and values JSON can't represent are reported instead of changed.

How it works

Private YAML formatting and validation in your browser

1

Paste or load YAML

Paste your YAML, or load a .yaml or .yml file. Nothing is uploaded.

2

Choose what to do

Format and validate, convert to JSON, or convert JSON to YAML, then set indentation and sorting.

3

Fix errors or copy the result

Problems are listed with line and column. Copy or download the result when it is valid.

Use cases

When this comes in handy

Debug a broken config

Find the exact line of a bad indent, duplicate key or unclosed bracket in a Docker Compose, Kubernetes or CI file.

Tidy a file before committing

Normalise indentation and optionally sort keys so diffs stay small and readable.

Move between YAML and JSON

Turn an API response into YAML for a config file, or a config into JSON for a script.

FAQ

Common questions

Is my YAML uploaded anywhere?

No. Parsing and formatting happen in your browser. Configuration files often contain secrets, so this matters; nothing is sent to a server.

Are comments kept when I format?

Yes. Formatting keeps comments, anchors, aliases and the quoting style of each value. Converting to JSON drops comments because JSON has none.

Which YAML version is used?

YAML 1.2. Under 1.2, words such as yes, no and on are plain text rather than booleans, unlike some older tools. Merge keys (<<) are understood.

What errors does it catch?

Syntax errors, bad indentation, tabs used for indentation, unclosed brackets and quotes, duplicate keys, and aliases that point to a missing anchor. Each is shown with its line and column.

What can't be converted to JSON?

Values JSON has no way to hold: .nan and .inf, mappings whose keys are lists or mappings, and non-text keys that can't be written. These are reported rather than silently changed. A file with several documents becomes a JSON array.

Related Tools