Skip to content
YAML Validator

YAML Validator

Validate YAML online. Paste your YAML and click validate to detect syntax errors and confirm if your YAML is valid.

Instant YAML validation Clear error messages for invalid YAML Copy and download YAML Import YAML from URL or file Theme switcher Fullscreen editor mode

YAML Input

Paste your YAML here, then click Validate

Key Features

  • Instant YAML validation
  • Clear error messages for invalid YAML
  • Copy and download YAML
  • Import YAML from URL or file
  • Theme switcher
  • Fullscreen editor mode

How to Use

  1. Paste your YAML into the editor
  2. Click “Validate” to check for errors
  3. If valid, you will see a success message

What "valid YAML" means here

Click Validate and the editor's text is parsed with js-yaml 4.1.0, the same library many Node.js tools use to read config files. If jsyaml.load succeeds, you see "Valid YAML!". If it throws, you see its error message, which names the problem and gives the position as (line:column). Your text is not changed or reformatted, so comments and layout stay exactly as they are.

Passing this check means the file is syntactically correct YAML under the YAML 1.2 rules js-yaml follows. It does not mean Kubernetes, Docker Compose, or GitHub Actions will accept it. Those tools apply their own schemas on top: a misspelled contianers: key is perfectly valid YAML.

Example: one space too many in a Compose file

services:
  web:
    image: nginx:1.27
    ports:
      - "8080:80"
     environment:
      - DEBUG=false
  db:
    image: postgres:16

Validation fails with:

bad indentation of a mapping entry (6:6)

environment: is indented 5 spaces while its siblings image and ports use 4, so the parser cannot tell which map it belongs to. Remove one space and the file validates. The column points to where the parser gave up, which is usually on or just after the misaligned key.

Indentation and tab errors

  • Tabs. "tab characters must not be used in indentation". YAML forbids tabs for indentation, full stop. Set your editor to insert spaces for .yml files.
  • List items glued to the dash. -name: Test is not a list item, because YAML needs a space after -. You get "bad indentation" on that line.
  • A list and a map at the same level. Starting with - a and following it with b: 1 at the same indent gives "end of the stream or a document separator is expected". A node is either a list or a map, never both.
  • Colons inside values. title: Note: read this fails, while time: 22:22 passes, because only a colon followed by a space starts a new key. Quote any value that contains ": ".
  • Apostrophes in single quotes. msg: 'it's broken' ends the string at the apostrophe. Double it ('it''s fine') or use double quotes. Unquoted it's fine is also valid.

Valid, but not what you meant: implicit typing

YAML guesses the type of every unquoted value, and a file can pass validation while its values mean something other than what you intended. js-yaml follows YAML 1.2, but many popular parsers still follow the older 1.1 rules.

  • The Norway problem. In a list of country codes, - NO is a string for js-yaml, but PyYAML and other YAML 1.1 parsers read it as false. The same applies to yes, no, on, and off. The on: key at the top of every GitHub Actions workflow is the best-known example: PyYAML reads it as True.
  • Base 60 numbers. A Compose port mapping like - 22:22 is the string "22:22" here, but YAML 1.1 parsers read it as the number 1342. This is why Docker's documentation quotes port mappings.
  • Leading zeros and versions. zip: 02134 loads as the number 2134, and python: 3.10 as 3.1.
  • Empty values. password: with nothing after it is null, not an empty string.

The fix for all of these is the same: quote the value. To see how every value was actually typed, paste the file into YAML to JSON.

Anchors, aliases, and other structure errors

  • "unidentified alias" means a *name refers to an anchor that was never defined, or is defined later in the file. Anchors must appear before their aliases. Values that start with *, such as glob: *.txt, hit the same error and need quotes.
  • Merge keys (<<: *common), as used in Compose x- extension blocks, are supported and validate normally.
  • "duplicated mapping key" is reported when a key appears twice in the same map. Some parsers silently keep the last value; js-yaml refuses the file.
  • Multi-document streams separated by ---, common in Kubernetes manifests, are rejected with "expected a single document in the stream, but found more". Validate each document separately.

Limitations

  • Syntax only: no JSON Schema or application-specific checks.
  • Only the first error is reported. Fix it and validate again.
  • Templates (Helm, Jinja, Ansible {{ }} expressions) must be rendered first. An unquoted {{ .Values.name }} is parsed as a nested map and can pass validation while meaning nothing useful.

When to use a different tool

  • To rewrite a valid file with consistent 2-space indentation, use the YAML Formatter (note that it removes comments).
  • To inspect parsed values and types, use YAML to JSON.
  • For JSON config files, use the JSON Validator.

Frequently asked questions

Why does YAML say "bad indentation of a mapping entry"?

A key is not lined up with its siblings, or a plain value contains a colon followed by a space, such as "title: Note: read this". Check the line and column in the message. Align the key with the others at the same level, or put the value in quotes.

Can I use tabs in YAML?

Not for indentation. The YAML specification forbids tab characters in indentation, and js-yaml reports "tab characters must not be used in indentation". Tabs inside quoted strings are fine.

What is the Norway problem in YAML?

YAML 1.1 parsers such as PyYAML read unquoted NO, no, off, and yes as booleans, so a list of country codes containing NO turns Norway into false. This validator uses js-yaml 4, which follows YAML 1.2 and keeps NO as a string, so the file passes here even if another tool misreads it. Quote such values to be safe everywhere.

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

It checks YAML syntax only. A misspelled key such as "contianers" or a wrong value type still passes, because the tool does not know any application's schema. Use kubectl --dry-run, docker compose config, or your CI provider's linter for that.

Can I validate a file with multiple documents separated by ---?

No. The validator accepts one document. A stream with several documents fails with "expected a single document in the stream, but found more". Paste each document on its own to check it.

Is my YAML sent to a server?

No. Validation runs in your browser with js-yaml. The editor saves its contents to your browser's local storage every two minutes so they can be restored later; Clear removes them.

Latest from Our Blog

Tips, tutorials, and insights about web development