A LITTLE HELP. A LOT DONE.
Good tools.
Great flow.

Your shortcut to the everyday. Create, convert, calculate,
and get back to what you love.

✓ Free to use✓ No sign-up✓ 500+ possibilities
Data

YAML Validator & Linter

Validate, format, and lint YAML in your browser. Get error messages with line numbers and convert to JSON.

Loading interactive tool…

About this tool

The YAML Validator & Linter uses the js-yaml library (loaded from CDN) to parse and validate YAML documents in your browser. On validation errors it reports the exact error message with line number and column for quick debugging. The Format button pretty-prints the parsed YAML with consistent 2-space indentation and no line wrapping. The JSON button converts the YAML to a formatted JSON object, which is useful when working with configuration files or APIs that require JSON. All processing is client-side.

Why use it

  • Precise error messages with line numbers and column positions — pinpoint the exact bad token

  • Format and JSON conversion in the same tool — no need to switch between three apps

  • Uses battle-tested js-yaml library for accurate YAML 1.2 parsing

  • No server upload — your YAML stays in your browser

How to use

  1. Paste your YAML into the text area, or load it from a file
  2. Click 'Validate' to check for syntax errors — a green or red status bar shows the result
  3. Click 'Format YAML' to pretty-print with consistent 2-space indentation
  4. Click '→ JSON' to convert the YAML to formatted JSON
  5. Click 'Copy' in the output area to copy the result to your clipboard
  6. Click 'Clear' to reset both input and output

When it helps

  • When debugging a Kubernetes or Docker Compose config that fails to parse
  • When you need to validate a CI/CD pipeline YAML before committing
  • When converting a YAML config to JSON for use with a REST API
  • When normalizing YAML indentation across a codebase
  • When debugging a Kubernetes Deployment, ConfigMap, or Helm chart that fails apply with cryptic errors
  • When you need to validate a CI/CD pipeline YAML (GitHub Actions, GitLab CI, CircleCI) before committing

Examples

Valid Kubernetes Pod manifest

Input
apiVersion: v1\nkind: Pod\nmetadata:\n  name: nginx\nspec:\n  containers:\n    - name: nginx\n      image: nginx:latest
Expected result
Validated successfully — same content emitted in canonical 2-space indentation

Tab character error

Input
key:\n\tvalue: 1 (a tab on line 2 instead of spaces)
Expected result
Error at line 2, col 1: bad indentation of a mapping entry — replace tab with spaces

Anchor and alias

Input
defaults: &d\n  timeout: 30\nprod:\n  <<: *d\n  host: prod.example.com
Expected result
JSON: { "defaults": {"timeout":30}, "prod": {"timeout":30, "host":"prod.example.com"} }

Special value as string

Input
version: 1.10\nenabled: yes\nstatus: null
Expected result
version → number, enabled → true (boolean), status → null. Quote them if you need them as strings.

Tips

  • Tab characters are forbidden in YAML indentation — if validation fails on a line that looks correct, check for stray tabs
  • When a key looks like a special value (true, false, yes, no, null, on, off), wrap it in quotes to keep it as a string
  • Use the to-JSON output to verify how a YAML file with anchors and aliases will actually be consumed
  • Indent consistently with 2 spaces — js-yaml accepts other widths but mixing causes hard-to-find errors
  • Multi-line strings: use | for literal block (preserve newlines) or > for folded (collapse to spaces)
  • Comments (lines starting with #) are dropped during format/round-trip — keep a backup if comments matter

Frequently Asked Questions

Which YAML version is supported?
js-yaml supports YAML 1.2 and most YAML 1.1 features. Multi-document YAML (multiple --- blocks) is supported — the tool loads the first document.
Does it catch all YAML errors?
Yes, all structural and syntax errors that js-yaml detects. It reports the exact message from the parser including line and column numbers.
What happens to comments during formatting?
YAML comments are not preserved during format/round-trip because js-yaml parses to a JS object and re-serializes without comments. Comments are stripped.
Can it validate multi-document YAML?
js-yaml.load() parses the first document in a multi-document stream. For multi-document validation, use loadAll().
Are anchors and aliases supported?
Yes. js-yaml resolves YAML anchors (&) and aliases (*) during parsing. The formatted output will show the resolved values, not the original anchors.
Is the JSON output always valid?
Yes. The output is produced by JSON.stringify with 2-space indentation, so it is always syntactically valid JSON.

Explore the category

Glossary

YAML
YAML Ain't Markup Language — a human-readable data serialization format using indentation and minimal punctuation, common for config files.
Scalar
A single value in YAML — string, number, boolean, or null. Scalars can be plain (no quotes), single-quoted, double-quoted, literal (|), or folded (>).
Sequence
An ordered list in YAML, written as either flow style ([a, b, c]) or block style with leading hyphens (- a / - b / - c).
Mapping
A YAML dictionary or hash — key-value pairs separated by colons. Equivalent to JSON objects.
Anchor
A node label declared with & (e.g. &defaults) that lets the same value be referenced multiple times via an alias, reducing duplication.
Alias
A reference to a previously declared anchor using * (e.g. *defaults). Resolved at parse time to the anchored value.
Multi-Document Stream
A single YAML file containing several documents separated by --- markers. Common for Kubernetes manifests bundling multiple resources.
Block Scalar
A multi-line string written with | (literal, preserve newlines) or > (folded, newlines become spaces). Used for embedded scripts and prose.