Free tool
YAML validator and formatter
Paste YAML to check it as you type. Errors show the exact line and column with a plain-English fix, warnings catch values that silently change type (like NO becoming false), and valid files get a clean, formatted copy with comments kept.
Free · no sign-up · runs in your browser, nothing is uploaded
Loading the parser…
The formatted YAML appears here.
What the validator checks
Errors mean a YAML parser will refuse the file. The validator uses the YAML 1.2 rules by default (switch to 1.1 to match PyYAML) and reports every error, not just the first:
- tabs used for indentation, and items of one map or list that do not line up
- unclosed quotes, brackets and braces
- duplicate keys in the same map
- aliases (
*name) with no matching anchor (&name), and alias chains that would expand into a huge value - characters YAML reserves (
@, a backtick,:inside a value) where a value needs quotes
Warnings mean the file is valid but probably does not say what you meant: values that YAML 1.1 parsers turn into booleans or numbers, version numbers that lose a trailing zero, numbers that lose a leading zero, and custom tags like !Ref that a standard parser ignores.
It does not check a schema. Whether spec.replicas belongs in a Deployment is Kubernetes' job: use kubectl apply --dry-run=server -f file.yaml.
Common YAML errors and how to fix them
| Error message | What it means | Fix |
|---|---|---|
Tabs are not allowed as indentation | A line starts with a tab. | Use spaces. Fix tabs replaces them. |
All mapping items must start at the same column | Keys of one map are indented differently. | Line them up with the same number of spaces. |
"port:" is indented more than the line above | A key sits deeper than the key before it, which already has a value. | Line it up with the key above, or nest it under a key with no value. |
Nested mappings are not allowed in compact mappings | A value contains ": ", e.g. title: Note: read me. | Quote the value: title: "Note: read me". |
Implicit keys need to be on a single line | A line has no colon where a key is expected, or a value wraps onto the next line. | Add the missing colon, or use | or > for long text. |
Map keys must be unique | The same key appears twice in one map. | Delete or rename one. Parsers that allow it keep the last. |
Missing closing "quote | A quoted string never ends. | Close the quote on the same value. |
Plain value cannot start with reserved character @ | Values may not start with @ or a backtick. | Quote the value. |
The Norway problem and other YAML 1.1 surprises
YAML 1.1 (2005) gave many unquoted words and number shapes a special type. YAML 1.2 (2009) dropped most of them, but PyYAML and other widely used libraries still follow 1.1, so the same file can mean different things in different tools:
| You write | YAML 1.1 reads | Why it hurts |
|---|---|---|
| country: NO | false | Norway’s country code becomes a boolean. |
| on: push | true: push | A key named on turns into true in PyYAML. GitHub Actions itself reads it as on, so this bites scripts that load workflow files. |
| ports: [22:22] | [1342] | Base-60 numbers: 22 × 60 + 22. Docker Compose ports should be quoted. |
| mode: 0755 | 493 | A leading 0 means octal. In YAML 1.2 the zero is dropped instead (755). |
| version: 1.10 | 1.1 | A float, in every YAML version. Quote version strings. |
The rule that avoids all of them: quote any value that is meant to be text but could look like a boolean, number or date. When you generate YAML from JSON, the JSON to YAML converter adds these quotes for you.
Validate YAML from the command line
For CI or a pre-commit hook, any of these fail with a non-zero exit code on invalid YAML:
# yamllint: syntax plus style rules (pip install yamllint) yamllint config.yaml # Python one-liner (PyYAML, YAML 1.1 rules), every document python3 -c 'import sys, yaml; list(yaml.safe_load_all(sys.stdin))' < config.yaml # yq (v4) yq '.' config.yaml > /dev/null # Docker Compose: parse and check the whole compose file docker compose -f compose.yaml config --quiet # Kubernetes: ask the API server without changing anything kubectl apply --dry-run=server -f deployment.yaml
Need the data as JSON afterwards? Use the YAML to JSON converter, or the [to JSON] link above the formatted output. For more config and deploy tooling, see DevOps tools on DevHunt.
How the formatter works
The formatter only touches layout. It re-indents to 2 or 4 spaces, lines up lists, tidies the space before # comments, and can sort keys alphabetically. It never re-types a value: 0755, yes and 1.10 are written back exactly as they were, quoted strings keep their quotes, and anchors, aliases, tags and comments stay. Inline { a: 1 } and [1, 2] collections stay inline. It formats only valid YAML, so fix the errors first.
Expand anchors writes every alias (*name) and << merge key out in full, with your own keys taking priority over merged ones. Use it to see what a merge really produces, or for a tool that does not support anchors. Values still keep their exact text.
More free developer tools
FAQ
How do I check if my YAML is valid?+
Paste it into the box above. The bar at the top turns green for valid YAML or red with the number of errors, and each error lists its line and column. Click an error to jump to that spot in your file. Nothing is uploaded.
Why is my YAML invalid?+
The usual causes are a tab used for indentation, items of the same map or list starting in different columns, a value with ": " in it that is not quoted, an unclosed quote or bracket, and the same key written twice in one map. The error message under the editor says which one it is and how to fix it.
Can YAML use tabs?+
Not for indentation. The YAML spec allows only spaces there. Tabs can appear inside values and between tokens, but a tab at the start of a line is an error. The Fix tabs button replaces leading tabs with spaces.
Are duplicate keys allowed in YAML?+
No. The spec says keys in one map must be unique. Some parsers, PyYAML among them, accept duplicates and keep the last value, so the first one is silently lost. This validator reports them as errors.
What is the Norway problem in YAML?+
In YAML 1.1, unquoted yes, no, on and off are booleans. A list of country codes with NO for Norway reads as false. YAML 1.2 fixed this, but PyYAML and other 1.1 parsers are still widely used. Quote such values ("NO") to be safe; the validator warns about each one.
Does this validate Kubernetes or Docker Compose files?+
It checks that the file is valid YAML and points out values that change type. It does not check whether Kubernetes or Compose accepts the fields. For that, run kubectl apply --dry-run=server -f file.yaml, or docker compose config for a Compose file.
Does formatting change my YAML?+
Only the layout. Indentation is normalized to 2 or 4 spaces and spacing around comments is tidied, but every value is written exactly as you typed it (0755 stays 0755, quotes stay quotes) and comments are kept. Sorting keys and expanding anchors and merge keys are optional.
What is the difference between a YAML validator and a linter?+
A validator answers one question: will a parser accept this file. A linter like yamllint also enforces style rules, such as line length, trailing spaces and a document start marker. This tool validates and adds warnings for values that parse differently than you might expect.
Sources: YAML 1.2.2 specification · YAML 1.1 boolean type · YAML 1.1 integer type · PyYAML resolver · yamllint docs · kubectl apply · docker compose config · yaml library docs. Checked October 2026.