YAML Validator

Validate YAML syntax online. Get precise error messages with line and column numbers, see a parsed structure preview on success. Free, runs in your browser — your data is not uploaded.

  • Runs in your browser
  • Your data never leaves your browser
  • Free · No Sign-Up
Click Validate or press Ctrl+Enter (⌘+Enter on Mac). Valid YAML shows a JSON preview. Errors include the parser reason, line, column and snippet when available. If any document has an error, each document is listed with available line ranges. Clear empties the input, status, errors, preview and precision note. Ctrl+L (⌘+L on Mac) does the same while focus is inside this tool.
Paste one YAML document or several separated by ---. Validation checks syntax, not an application schema or lint rules. Editing does not validate automatically; click Validate again to update the result.

Validate YAML to see its parsed structure or syntax errors here.

Examples, details and FAQ Worked examples, how it compares with other tools, and answers to common questions.

Understanding the Error Output

When validation fails, the error box contains:

  • Reason — a plain-English description of what went wrong (e.g., bad indentation, unexpected end of stream).
  • Line & Column — the exact position of the error in your input.
  • Snippet — the surrounding context from the parser, often showing a caret (^) pointing at the problem character.

Common YAML Syntax Errors

  • Inconsistent indentation — YAML requires consistent use of spaces (never tabs) for nesting. Mixing 2-space and 4-space indentation on the same level causes parse errors.
  • Missing colon after a key — key value is invalid; it must be key: value.
  • Unquoted special characters — characters like :, #, [, ], {, } in values must be quoted or escaped.
  • Tab characters — YAML prohibits tabs for indentation. Replace all tabs with spaces.
  • Duplicate keys — while some parsers allow them, duplicate keys in the same mapping block are technically invalid YAML 1.2.

Example: Valid YAML

server:
  host: localhost
  port: 8080
  tls: true

database:
  driver: postgres
  name: myapp
  credentials:
    user: admin
    password: "s3cr3t"

allowed_origins:
  - https://example.com
  - https://api.example.com

Example: Invalid YAML (indentation error)

server:
  host: localhost
   port: 8080   # error: extra space causes inconsistent indentation

The validator will report the line and column where the inconsistency is detected, making it easy to locate and fix.

Valid Is Not the Same as Correct

The validator reports syntax errors. YAML that parses can still have the wrong structure, so read the Parsed Structure preview. In this file, carrot lost two spaces of indentation:

fruits:
  - apple
vegetables:
- carrot
  - spinach

The validator says it is valid, and the preview shows "vegetables": ["carrot - spinach"]: the next line was joined to carrot as one string.

YAML 1.1 and YAML 1.2 Read Values Differently

This tool uses js-yaml 4.3.2, which follows YAML 1.2. PyYAML follows YAML 1.1. The same file gives different data:

YAMLThis tool (js-yaml 4.3.2)PyYAML 6.0.3 safe_load
debug: yes"yes" (string)True
country: NO"NO" (string)False
octal: 0777777511
time: 12:30"12:30" (string)750

If a file is read by a YAML 1.1 parser, quote values such as "NO", "yes", and "0777".

Error Messages You Will See

InputMessage from the validator
message: Error: something went wrongbad indentation of a mapping entry (1:15); quote the value
A tab before host:tab characters must not be used in indentation
timeout twice in one mappingduplicated mapping key
server without a colon, then an indented lineend of the stream or a document separator is expected

Limits

  • Several documents are checked one by one. A file with documents separated by ---, such as a Kubernetes manifest with a Deployment and a Service, is read with js-yaml loadAll. When all are valid, the preview shows a JSON array with one item per document. When one has an error, each document is listed with its line range as valid or with its error, so a broken Service does not hide a valid Deployment.

  • Syntax only. The tool does not check a Kubernetes, GitHub Actions, or Docker Compose schema, and it does not apply lint rules. For CI, run yamllint (yamllint .).

  • The preview is JSON. Anchors and << merge keys are expanded in the preview, and comments are not shown. Values that JSON cannot show as written are listed above the preview with their JSON Pointer paths; the YAML is still reported as valid. This YAML:

    size: .inf
    id: 9007199254740993
    due: 2026-02-31

    shows The JSON preview does not show these values as written: /size: inf has no JSON form (JSON.stringify would write null); /id: integer 9007199254740993 is outside ±(2^53 − 1), so JavaScript would round it; /due: 2026-02-31 is not a valid date or time. The preview has null, 9007199254740992 and "2026-03-03T00:00:00.000Z" in their place, so do not copy it as the data. The preview writes negative zero as -0.0 and shows timestamps in UTC (2026-10-01T09:30:00+09:00 appears as "2026-10-01T00:30:00.000Z").

  • js-yaml work limits. js-yaml 4.3.2 stops a document whose collections are nested more than 100 levels deep, whose merge keys (<<) handle more than 10,000 mappings and keys in total, or that lists more than 100 mappings in one merge key. The error names the limit, for example “collections are nested more than 100 levels deep (the js-yaml default limit)”, with its line and column.

FAQ

What does the YAML Validator check?

It checks your YAML for syntax errors using the js-yaml parser (YAML 1.2 compliant). Any malformed YAML — indentation errors, unexpected characters, duplicate keys, missing colons — will be caught and reported with a precise line and column location.

How is this different from a YAML to JSON converter?

A converter assumes your input is valid and transforms it. A validator focuses on whether your YAML is syntactically correct, giving you detailed error messages to help you fix problems. This tool is designed for the 'yaml validator online' use case — diagnosing and fixing bad YAML, not converting it.

What is the Parsed Structure preview?

When your YAML is valid, the tool parses it and displays the resulting data as a formatted JSON object. This helps you visually confirm the structure matches what you expect, and lets you copy the JSON equivalent for use elsewhere. Values JSON cannot show as written, such as .inf, integers outside ±(2^53 − 1) and impossible dates such as 2026-02-31, are listed above the preview with their paths.

Which YAML spec is supported?

The tool uses js-yaml 4.x, which implements the YAML 1.2 specification. This covers all common YAML syntax including anchors, aliases, multi-line strings, block and flow sequences, and explicit type tags. A file with several documents separated by --- is read with loadAll, and each document gets its own result.

Is my YAML sent to a server?

No. Validation runs in your browser using JavaScript. Your YAML content never leaves your machine.