YAML Validator

Paste YAML or JSON and this validator detects the format, checks it live with line-numbered errors, and converts it to the other format in one click — plus a fixer for tab indentation and trailing whitespace. Nothing leaves your browser.

Validation status

Paste or type YAML or JSON to validate it.

How YAML validation works

A YAML parser works in two passes. Tokenizing splits the text into indentation, keys, colons, quotes, brackets, and scalars; parsing then assembles those tokens into mappings, sequences, and scalars according to the YAML 1.2 spec. This validator runs both passes in your browser on every keystroke, then adds linter checks — duplicate keys, tab indentation, trailing whitespace — and reports each finding with its line number. Multi-document files split on --- are parsed and validated one document at a time. Pasted text counts as JSON when it parses as strict JSON or looks bracket-led; everything else validates as YAML.

Example: a tab that breaks a file

Take a two-line file where line 1 is server: and line 2 is port: 8080 indented with a tab. The parser stops with a tab-indentation error pointing at line 2. Click Fix YAML with the indent set to 2 spaces and the tab becomes two spaces — the file now validates as correct, and clicking View as JSON shows port 8080 nested inside server in JSON form. The same paste-and-fix flow handles trailing whitespace and a missing final newline.

Frequently asked questions

What is a YAML validator?

A YAML validator checks whether a document follows the YAML specification: spaces-only indentation, closed quotes and brackets, valid key-value syntax, and no duplicate keys. It parses the file the same way a deploy pipeline would, then points to the exact line and column of every mistake — before a Kubernetes apply or a CI run fails on it.

How can I check if my YAML is valid online?

Paste the document into the editor above. It validates as you type — no button to click and no file to upload — and lists every syntax error with its line number in plain language. When the YAML is valid, the JSON view appears so you can confirm exactly what a parser will read.

What does Fix YAML change?

It normalizes inconsistent indentation, replaces tab indentation with 2 or 4 spaces (per the Indent selector), removes trailing whitespace, removes later duplicate key lines, closes unterminated quotes and unbalanced brackets, and adds a missing final newline. Every change is listed afterward. Problems it cannot fix stay listed below with their line numbers.

Why are tabs not allowed in YAML?

The YAML specification forbids tabs for indentation — only spaces may indent. Editors insert tabs silently when you press Tab, and the resulting parser error often points to a line far from the real cause. This validator names the exact line, and Fix YAML converts each tab to the selected indent width.

Does it support multi-document YAML files?

Yes. Files that separate documents with ---, such as Kubernetes manifests combining a Deployment and a Service, are validated document by document instead of failing on the first mistake. Each document gets its own errors, and the JSON view returns an array with one entry per document.

What is the difference between a YAML validator and a YAML linter?

A validator (or syntax checker) reports whether the document parses: pass or fail. A linter goes further and flags fragile structure that still parses — duplicate keys that silently overwrite each other, trailing whitespace, inconsistent indentation. This tool runs both passes together and marks blocking errors separately from warnings.

Can I convert YAML to JSON and JSON to YAML?

Yes, both directions. Paste either format and the tool detects it automatically; the button then offers the opposite view — View as JSON when you pasted YAML, View as YAML when you pasted JSON. Conversion uses your chosen 2- or 4-space indent, multi-document YAML becomes a JSON array, and Copy or Download saves the result as data.json or data.yaml.

Is my YAML uploaded anywhere?

No. Parsing, linting, fixing, and YAML-to-JSON conversion all run in your browser, and nothing you paste is transmitted, logged, or stored. Close the tab and it is gone, which makes the tool safe for configs that contain internal hostnames or secrets.

What are the most common YAML errors?

In practice: a tab where a space belongs, a key indented one column too far, an unterminated quote, an unclosed bracket in flow style, a missing colon after a key, and duplicate keys. All six are caught here with line numbers, and the first one is fixed with a single click.

Developer Tools