Hunt
Skip to content

YAML Validator & Formatter

Paste YAML, from Kubernetes, GitHub Actions, Docker Compose or any configuration file, to check it's valid and see exactly where it isn't. The tool also flags values that might not mean what you think, such as NO, on, 0755 or version: 1.10, and formats the file with Prettier, keeping your comments. Nothing is uploaded.

Runs in your browser

YAML

Paste YAML or press Sample

Formatted

Formatted YAML will appear here

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:value is a single string, not a key and a value; write key: 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

  1. Paste YAML, or press Sample.
  2. Fix any error: select its location to jump to it.
  3. Read the things to check, and quote values you mean as text.
  4. Copy or download the formatted YAML.

Examples

Tidy spacing, comments kept

Input
# Deployment settings
name:   web    # service name
replicas:  3
ports: [ 80,443 ]
env:
    - name: LOG_LEVEL
      value:   info
Output
# Deployment settings
name: web # service name
replicas: 3
ports: [80, 443]
env:
  - name: LOG_LEVEL
    value: info

4-space indentation and single quotes

Input
services:
  db:
    image: 'postgres:16'
    environment: {POSTGRES_USER: app, POSTGRES_DB: app}
Output
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 !Ref are 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.