Common YAML errors
- Tabs: YAML indentation must use spaces; a tab anywhere in the indentation is an error.
- Inconsistent indentation: items of the same mapping or list must start in the same column.
- Missing space after a colon:
key:valueis a single string, not a key and a value; writekey: value. - Duplicate keys: a key may only appear once in a mapping. Many parsers silently keep the last value; this tool reports it.
- Unquoted special characters: values starting with
*,&,!,%or@, or containing:or#, need quotes.
How to use the YAML Validator & Formatter
- Paste YAML, or press Sample.
- Fix any error: select its location to jump to it.
- Read the things to check, and quote values you mean as text.
- Copy or download the formatted YAML.
Examples
Tidy spacing, comments kept
# Deployment settings
name: web # service name
replicas: 3
ports: [ 80,443 ]
env:
- name: LOG_LEVEL
value: info
# Deployment settings
name: web # service name
replicas: 3
ports: [80, 443]
env:
- name: LOG_LEVEL
value: info
4-space indentation and single quotes
services:
db:
image: 'postgres:16'
environment: {POSTGRES_USER: app, POSTGRES_DB: app}
services:
db:
image: 'postgres:16'
environment: { POSTGRES_USER: app, POSTGRES_DB: app }
Valid, but probably wrong
Some YAML is valid but doesn't mean what it looks like. YAML 1.1 parsers, still used by PyYAML, Ruby and many CI systems, read NO, on and yes as booleans and 0755 as the octal number 493; YAML 1.2 parsers don't. An unquoted 1.10 is the number 1.1. The tool lists these values with their line, so you can quote the ones you mean as text.
Options
- YAML version
- 1.2 (the default) or 1.1, the version your parser uses; it decides which values are flagged.
- Indent
- 2 or 4 spaces.
- Prefer single quotes
- Use single quotes for strings that need quoting, where possible.
Limitations
- The tool checks YAML syntax, not a schema: it doesn't know which keys Kubernetes or GitHub Actions expect.
- Formatting keeps comments but normalises spacing and blank lines.
- Custom tags such as
!Refare accepted and kept.
Frequently asked questions
Is my YAML uploaded?
No. Validation and formatting run in your browser; nothing you paste is sent anywhere.
Why is my YAML invalid when it looks fine?
The most common causes are a tab in the indentation, items of one list or mapping not starting in the same column, and a missing space after a colon. The error shows the line and column where the parser stopped.
Does it validate Kubernetes manifests?
It checks that they're valid YAML and flags suspicious values. To check fields against the Kubernetes schema, use kubectl apply --dry-run=server or a schema validator.
How do I convert YAML to JSON?
Use the YAML to JSON converter.