YAML Validator and Linter

Check YAML syntax as you type and get each problem with its line number and a plain explanation, plus warnings for values that PyYAML, Go and other YAML 1.1 parsers read differently.

Input
Output

    Nothing leaves your browser. Shortcut: Ctrl/⌘ + Enter runs the main action.

    What is a YAML validator?

    A YAML validator parses a YAML document and reports whether it follows the YAML 1.2 specification, and if not, where and why it fails. Because YAML uses indentation and a few punctuation marks for structure, most errors come from whitespace and are hard to see. This validator gives the line and column of every error, a plain explanation, the parser's own message for reference, and hints for the most common causes.

    How to validate YAML

    1. Paste YAML or open a file; it is checked while you type.
    2. Read the status line: green for valid (with the number of documents, keys and nesting depth), yellow when there are warnings, red for errors.
    3. Click a problem to jump to it in the editor.
    4. When it is valid, format it or convert it with YAML to JSON.

    Common YAML errors

    ProblemExampleFix
    Tab used for indentation␉image: nginxIndent with spaces only
    No space after the colonreplicas:3replicas: 3
    Inconsistent indentationa key indented 3 spaces under siblings at 2Align it with its siblings
    Unclosed flow collectionports: [80, 443ports: [80, 443]
    Value starting with a reserved characteruser: @adminuser: "@admin"
    Duplicate keyname: a … name: bKeep one of them
    Alias to an undefined anchor<<: *defaults without &defaultsDefine the anchor above

    YAML 1.1 pitfalls the linter warns about

    These values are valid, but they mean different things depending on the parser. YAML 1.2 (used by this tool and by modern libraries such as eemeli/yaml and Go's yaml.v3) reads them one way; YAML 1.1 parsers such as PyYAML, Ruby's Psych and Go's yaml.v2 read them another way. Quoting them makes every parser agree.

    Example

    spec:
      replicas:3
      template:
        spec:
          containers:
            - name: web
    	  image: nginx

    The validator reports that line 2 has no space after the colon, so YAML reads replicas:3 as one string, and that line 7 uses a tab for indentation. Fix both and the document parses.

    YAML validator questions

    Why is my YAML invalid when it looks fine?

    Usually because of whitespace you cannot see: a tab character in the indentation, a line indented one space more or less than its siblings, or a missing space after a colon (key:value). The validator points to the exact line and names the problem.

    What is the Norway problem?

    In YAML 1.1, unquoted yes, no, on, off, y and n are booleans, so a list of country codes containing NO (Norway) turns into false. YAML 1.2 fixed this, but PyYAML, Ruby and many tools still follow 1.1. The validator warns about these values so you can quote them.

    Does it validate Kubernetes, Docker Compose or GitHub Actions files?

    It validates YAML syntax, which is what most errors in those files are. It does not check the schema of a specific tool, such as whether a Kubernetes field name exists; use kubectl --dry-run, docker compose config or the tool's own linter for that after the syntax is clean.

    Are duplicate keys errors in YAML?

    Yes. The YAML specification requires mapping keys to be unique, and this validator reports duplicates as errors. Some parsers accept them silently and keep the last value, which hides bugs.

    Can I validate a file with several documents?

    Yes. Documents separated by --- are each validated, and the status line shows how many documents were found.

    Why does 3.10 get a warning?

    Unquoted 3.10 is a number, so it is read as 3.1 and the trailing zero is lost. That breaks version strings such as a Python version in a CI matrix. Quote it: "3.10".