YAML input
Convert on YAML to JSON.
Parse resultValid
Valid YAML (js-yaml load)
{
"foo": "bar"
}Free YAML Validator & Parser Online - js-yaml, Not a K8s Linter
Parse YAML in your browser with js-yaml. The default foo: bar loads as {"foo":"bar"}. Tabs and broken indentation fail. This is not a Helm or CRD linter.
What Is a YAML Validator?
A YAML validator - also searched as a YAML parser, YAML syntax checker, or YAML linter - is a tool that asks one question: can this text be loaded as YAML? This page answers that with js-yaml load. It does not ask whether a Deployment is well-typed, whether a Helm values file matches a chart schema, or whether a GitHub Actions workflow uses a legal job key. Those are schema jobs. This is a document job.
YAML (YAML Ain't Markup Language) is the configuration dialect of Docker Compose, Ansible, Kubernetes manifests, GitHub Actions, OpenAPI fragments, and countless CI files. Unlike JSON, YAML is indentation-sensitive, allows comments, and has a rich set of scalars. That flexibility is why people write it by hand and why a single tab character can make a parser reject a file that looks fine in an editor that shows whitespace as identical to spaces.
The worked check on this page is the default mapping foo: bar. js-yaml loads it as the JavaScript object whose JSON form is {"foo":"bar"}. If that mapping fails on your machine, the parser did not load. If it succeeds, you have a passing parse - not a Kubernetes admission review.
How to Validate YAML - Step by Step
Checking YAML here takes a few seconds. Parsing runs as you type:
- Paste your YAML - Paste into the left panel. Keep the default
foo: barfor a passing mapping, or replace it with a document you wrote. - Read the parse result - js-yaml
loadruns as you type. A valid document shows the JavaScript value as indented JSON. Indentation errors, tabs, and illegal tokens show a line and column. - Quote ambiguous scalars - If a country code or the words
on/offbecome booleans, quote them. That is YAML 1.1 typing, not a Kubernetes schema check. - Copy or convert - Copy the JSON view if you need a note. Dedicated conversion belongs on the YAML to JSON page. This page is the syntax check.
- Fix indentation - Use spaces, not tabs. Nested keys must indent further than their parent. A dangling colon with no value is often a typo, not a feature.
YAML Validation Example - Before & After
Here is the default document and the value js-yaml produces. That pair is the worked check for this tool.
Input - YAML mapping
foo: bar
Output - loaded JSON view
{
"foo": "bar"
}A nested example that still parses as YAML (and is still not a cluster check):
Input - nested mapping with a sequence
service:
name: api
ports:
- 8080
- 8443Output - JSON view of the same value
{
"service": {
"name": "api",
"ports": [
8080,
8443
]
}
}The JSON view is a convenience so you can see types: unquoted 8080 became a number, not the string "8080". If you needed a string port, quote it in the YAML. Conversion as a product feature still lives on YAML to JSON.
When You Need a YAML Parser - Real-World Use Cases
Catching tab characters before CI
Many YAML parsers reject tabs in indentation. Editors that mix tabs and spaces will produce a file that looks aligned and still fails js-yaml. Pasting the file here reports a mark with line and column so you can replace tabs with spaces before a pipeline does it for you at 2 a.m.
Checking Docker Compose and Ansible snippets
Compose files and playbooks are YAML documents first. If the parser cannot load them, Compose will not apply services and Ansible will not run tasks. This page will not validate Compose schema keys such as deploy.replicas, but it will tell you the file is not YAML at all.
Inspecting types before they hit JSON APIs
YAML 1.1 can turn unquoted NO into boolean false (the Norway problem). Country codes, the words on and off, and some version-like scalars surprise people when they later become JSON. The JSON view on the right makes that typing visible.
Debugging broken indentation in nested maps
A key that should be nested under spec but sits at the same column as metadata is still "valid YAML" with a different shape. The JSON view shows the structure you actually loaded, which is often the bug even when the parse succeeds.
Not substituting for kubectl or kubeval
If your job is "does this Deployment satisfy the Kubernetes OpenAPI?" this page will not answer it. A syntactically valid YAML file can still be a nonsense manifest. Use cluster tooling for that. Use this page when the error is "could not parse YAML".
Reviewing a gist or a pasted config
When someone pastes YAML into a ticket, the first failure mode is invalid syntax. Loading it here is faster than installing a CLI when you only need to know whether the document is well-formed YAML.
YAML Parser vs Kubernetes Linter vs YAML to JSON
These three jobs are often searched as if they were one tool. They are not:
| Job | This YAML validator | K8s / Helm linter | YAML to JSON |
|---|---|---|---|
| Can js-yaml load the text? | ✓ | ✓ | |
| Default foo: bar → {"foo":"bar"} | ✓ | ||
| Check apiVersion / CRDs | ✓ | ||
| Helm values schema | ✓ | ||
| Download converted JSON | ✓ | ||
| Tabs / indent errors | ✓ | ✓ |
The general rule: parse first, lint schemas second, convert when you need another format. This page stops at parse.
Common YAML Parse Errors - What js-yaml Reports
These are the failures this validator is built to surface. None of them are Kubernetes resource errors:
- Tab indentation. YAML is a spaces dialect for indent. A tab in the indent column often throws. Switch the editor to spaces.
- Inconsistent indent width. Mixing 2-space and 3-space nested keys confuses the block parser. Pick one width and stay with it.
- Duplicate keys. js-yaml typically keeps the later value. That is a silent logic bug more often than a hard error. The JSON view shows which value survived.
- The Norway problem. Unquoted
NO,yes,on, andoffcan become booleans under YAML 1.1. Quote country codes and switch names if they are strings. - Unquoted special characters. Colons inside unquoted strings, unmatched quotes, and stray
{or[in plain scalars produce scan errors with a mark. - Multi-document files. This page uses a single
yaml.load. Streams separated by---may load only the first document.loadAllis out of scope. - Unsafe tags. This page does not use an unsafe load. Typical mappings and sequences load. Custom constructors that execute code are not invited.
YAML 1.1 Typing, Flow Style, Anchors, and Comments
JSON has six value types and no comments. YAML has comments, block scalars, flow collections that look like JSON, and a historical type system that still surprises people who treat YAML as "JSON with less punctuation." js-yaml's load is the YAML 1.1-flavored parser most Node tools still ship. YAML 1.2 tried to make unquoted NO a string. This page is not a 1.2-only checker. If your production parser is PyYAML, ruamel, or Go's yaml.v3, quote anything that looks like a boolean, sexagesimal, or version-like scalar rather than arguing about which spec your CI actually uses.
Flow style is legal YAML: {foo: bar} is the same mapping as the default block form. A sequence can be [8080, 8443] instead of dashed lines. Mixing flow and block is allowed; mixing tabs into either is not. Anchors and aliases (&id / *id) are YAML features this parser will load as shared JavaScript references when the document is valid. They are not Kubernetes $ref pointers and they are not JSON Schema. If you paste a Helm template full of {{ .Values }}, that is Go text/template, not YAML - the parser will fail at the braces unless they are quoted.
Comments starting with # are stripped during load. They never appear in the JSON view. That is expected. If you needed comments to survive a round-trip, you wanted a different product: a document editor, not a validator. Empty documents and documents that load as null are still "valid YAML" in the parse sense. A file that contains only # comment often loads as null. That is not an error here; it is a reminder that "valid" is not "useful."
Integers, floats, and timestamps are another typing trap. Unquoted 1.0 may become a number. Unquoted 2020-01-01 may become a Date in some YAML 1.1 loaders. Quote values you intend to keep as strings. The JSON view on the right is the fastest way to see what this specific library decided. It is not a promise that every other YAML library will decide the same way.
Block scalars with | (literal) and > (folded) are valid YAML and load as strings. They are a common source of "it parsed but the newline vanished" confusion. Folded scalars join lines with spaces; literal scalars keep newlines. If your CI secret file uses a literal block for a PEM, you want |, not >. This validator will load both; it will not tell you which one your deployer expected. Merge keys (<<) are a 1.1-era feature some parsers still expand. Do not rely on this page as a merge-key specification. If the document loads, you get a JSON view of whatever js-yaml produced.
Privacy & Security - 100% Browser-Side Parsing
All YAML loading runs in your browser with js-yaml. The document is not uploaded. That makes the tool usable for private Compose files, Ansible inventories with redacted secrets, and draft manifests you would not paste into a random hosted linter.
Your input is saved under the unique key yaml-validator-data in this browser's localStorage for up to 30 days. Panel width uses yaml-validator-panel-width. The split track class yaml-validator-split-track is unique so desktop resize does not collide with other tools. Click Clear to restore foo: bar.
Frequently Asked Questions
Which YAML version does this validator use?
js-yaml implements YAML 1.1 with some 1.2 behaviors. The Norway problem still exists: an unquoted NO can become boolean false. Quote country codes and the strings on/off if they are not booleans in your domain.
What does the default foo: bar sample parse to?
foo: bar parses to {"foo":"bar"}. That is the worked check. A tab-indented block may fail. Duplicate keys: js-yaml typically keeps the later value.
Is this a Kubernetes manifest linter?
No. It will not check apiVersion, kind, CRDs, or Helm values schemas. It only asks whether js-yaml can load the text as YAML.
Does the parser execute YAML tags?
Unsafe load is not used. yaml.load is the safe default in current js-yaml for typical mappings and sequences. Unknown types should not run code.
Does my YAML leave the browser?
No. Parsing runs in your browser. Drafts stay in localStorage on this device for up to 30 days and are never uploaded.
When should I use YAML to JSON instead?
Use YAML to JSON when conversion is the job. This page is the syntax check: can js-yaml load the document, and what JavaScript value did it produce.
Why did my country code NO become false?
YAML 1.1 treats several unquoted scalars as booleans, including NO, yes, on, and off. Quote them if they are strings. This is not a Kubernetes validation failure.
Can I validate multi-document YAML files?
This page uses a single yaml.load call. Documents separated by --- may load only the first document. loadAll is out of scope here.
Related YAML, JSON & Validator Tools
If you work with YAML and structured config regularly, these tools complete the workflow:
- YAML to JSON - Convert a valid YAML document into JSON when conversion is the job, not merely a parse preview.
- JSON Formatter - Pretty-print the JSON view if you take it elsewhere.
- JSON Validator - Strict RFC 8259 checks when the output must be JSON, not YAML.
- JSON5 Validator - Comments and trailing commas live in JSON5, not in YAML or RFC 8259 JSON.
- XML Validator - Well-formedness for XML, a different family of config files.
- JSON Schema Validator - Schema checks after you already have JSON, not YAML resource types.
Related Tools
Discover more free developer tools that might interest you.
JSON Validator
Validate RFC 8259 JSON and report line and column errors
Use ToolJSON5 Validator
Validate JSON5 (comments, trailing commas, unquoted keys)
Use ToolCSS Validator
Parse CSS and report syntax errors with locations
Use ToolJavaScript Validator
Parse JavaScript syntax with Acorn. Does not run the code
Use ToolXML Validator
Check that XML is well-formed. Not a full XSD or DTD validator
Use ToolCredit Card Validator
Luhn checksum and brand from IIN prefix. Format check only, numbers are not stored
Use Tool