YAML Validator

Validate YAML syntax and structure

What is YAML?

YAML (YAML Ain’t Markup Language) is a human-readable data serialization language that has become the de facto standard for configuration files in modern DevOps and software development. Originally released in 2001, YAML was designed to be more readable than XML and simpler than JSON for configuration purposes.

YAML powers Kubernetes manifests, Docker Compose stacks, Ansible playbooks, GitHub Actions workflows, GitLab CI pipelines, CircleCI configs, OpenAPI/Swagger specs, and countless application configuration files. Its reliance on indentation rather than brackets or tags makes it visually clean — but also makes it sensitive to formatting errors that block deploys and break builds.

How to Use the YAML Validator

  1. Paste your YAML content into the input area — a Kubernetes manifest, a .gitlab-ci.yml, a Helm values file, or any YAML document.
  2. Click “Validate” or press Ctrl+Enter to check syntax.
  3. Review any errors reported with line numbers and a short explanation.
  4. Fix the issues and re-validate until the file is clean.

The validator checks the most common YAML issues: tab characters, inconsistent indentation, duplicate keys, malformed key-value pairs, and incorrect list syntax. Everything runs in your browser — no upload, no signup, no waiting.

Common YAML Errors and How to Fix Them

Tab Characters

YAML strictly forbids tab characters for indentation. This is the single most common YAML error:

# Wrong (uses tabs)
server:
	port: 8080

# Correct (uses spaces)
server:
  port: 8080

Configure your editor to use spaces instead of tabs for YAML files. In VS Code, set "editor.insertSpaces": true and "editor.tabSize": 2 for .yml and .yaml files.

Inconsistent Indentation

All items at the same level must use the same number of spaces:

# Wrong
database:
  host: localhost
   port: 5432

# Correct
database:
  host: localhost
  port: 5432

Duplicate Keys

YAML doesn’t allow duplicate keys at the same level. The second value silently overwrites the first, which can cause hard-to-debug issues — especially in Kubernetes manifests where a duplicated name or port field can change deployment behavior in subtle ways:

# Wrong - 'port' appears twice
server:
  port: 8080
  host: localhost
  port: 3000

Missing Colon in Key-Value Pairs

Every key must be followed by a colon and a space:

# Wrong
name John

# Correct
name: John

Decoding Common YAML Parser Error Messages

When a YAML file fails in your CI pipeline, in kubectl, or inside a language parser like PyYAML or js-yaml, the error text is often cryptic. Here’s what the messages you actually paste into Google mean — and how to find the offending line fast.

Error messageWhat it usually meansHow to fix
mapping values are not allowed hereAn unquoted value contains a colon-space (: ), so the parser thinks a new key started mid-value — e.g. title: Chapter 1: Intro.Wrap the value in quotes: title: "Chapter 1: Intro".
could not find expected ':'A key is missing its colon, or a line is indented so it merges into the line above.Add the missing : and check the indentation of the reported line.
found character '\t' that cannot start any tokenA tab was used for indentation somewhere on the line.Replace tabs with spaces — this validator flags the exact line number.
found unexpected end of streamA quoted string was opened but never closed.Add the missing closing " or '.
expected <block end>, but found ...A sibling line is indented more or less than the others, so the parser can’t close the block.Align every key or list item in the block to the same indentation.
duplicate key / found duplicate keyThe same key appears twice in one mapping; the second value silently wins.Rename or remove the duplicate — this validator reports both line numbers.

A useful mental model: YAML errors are almost always indentation, a stray colon, a tab, or an unclosed quote. The parser reports where it gave up, which is often a line or two after the real mistake — so when the reported line looks fine, check the lines directly above it. Paste the whole file here first: the validator flags tabs, duplicate keys, and indentation mismatches with line numbers, which resolves most of these messages before you ever reach the deploy step.

Validating CI/CD YAML — GitLab CI, GitHub Actions, CircleCI

CI/CD pipeline files are where YAML errors hurt the most: a single bad indent in .gitlab-ci.yml or .github/workflows/deploy.yml means a wasted commit, a failed pipeline run, and a few minutes of waiting just to learn you forgot a colon.

Paste your pipeline file into this validator before you push:

  • GitLab CI (.gitlab-ci.yml) — catches syntax errors before GitLab’s own runner does. For full schema validation against GitLab keywords (stages, script, rules, needs, extends), use GitLab’s built-in CI Lint at <your-project>/-/ci/lint. The two together — syntax here, schema there — give you near-zero failed-pipeline noise.
  • GitHub Actions (.github/workflows/*.yml) — most failures are indentation under jobs: or steps:. Validate first, then trust GitHub Actions to surface anything more semantic when it runs.
  • CircleCI (.circleci/config.yml) — same pattern. Run a syntax check here, then circleci config validate locally for the schema layer.
  • Bitbucket Pipelines, Drone CI, Argo Workflows — all standard YAML, all validated the same way.

The principle: every modern pipeline tool layers schema rules on top of YAML, but they all assume the YAML itself parses. Catching syntax errors locally cuts the feedback loop from “push and wait 90 seconds” to “Ctrl+Enter, fix, push once”.

Validating Kubernetes Manifests and Helm Charts

Kubernetes is YAML’s most demanding home. A misindented field in a Deployment manifest can silently change the behavior of an entire cluster, and the error you eventually see from kubectl apply rarely points at the real cause.

Use this validator as the first step before any kubectl apply:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
spec:
  replicas: 3
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
        - name: my-app
          image: my-app:1.0.0
          ports:
            - containerPort: 8080

For Helm charts, validate Chart.yaml, values.yaml, and any templates/*.yaml (after rendering — helm template my-release ./chart). For kustomization.yaml, the same rules apply.

After syntax passes here, layer on schema validation:

  • kubectl apply --dry-run=client -f file.yaml — catches schema issues without touching the cluster.
  • kubectl apply --dry-run=server -f file.yaml — adds admission-controller checks (RBAC, validating webhooks, OPA policies).
  • kubeval, kubeconform, or kube-linter for offline schema validation against specific Kubernetes versions.

Each tool checks a different layer. This validator covers the bottom layer — the YAML itself — and runs in your browser, so cluster credentials never leave your machine.

Validating Advanced YAML — Anchors, Aliases & Multi-Document Files

Real-world config files use YAML features that trip up quick mental parsing. These are all valid YAML, and the validator accepts them without false errors — but each hides its own class of mistakes.

Anchors and Aliases (& and *)

Anchors let you define a block once and reuse it, keeping large configs DRY:

defaults: &defaults
  adapter: postgres
  host: localhost

development:
  <<: *defaults
  database: dev_db

production:
  <<: *defaults
  database: prod_db

&defaults names the block, *defaults references it, and <<: merges the referenced keys in. The most common mistakes: referencing an alias (*name) that was never anchored, or defining the anchor after the alias that uses it — anchors must appear first. If a parser reports found undefined alias, you’ve hit exactly this.

Multi-Document Files (---)

A single .yaml file can hold several documents separated by ---, which is standard for Kubernetes manifests that bundle a Deployment, Service, and ConfigMap together:

apiVersion: v1
kind: Service
metadata:
  name: my-app
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app

Each document between separators is validated independently. A frequent error is forgetting the --- between two documents, which silently merges them into one mapping — often surfacing as a confusing duplicate-key error. The optional ... marker explicitly ends a document.

Multi-Line Strings (| and >)

Block scalars hold long text without escaping. | (literal) preserves newlines; > (folded) collapses them into spaces. The trap is indentation: every line of the block must be indented deeper than the key, and that indentation is stripped from the result. A blank line at the wrong spot or an under-indented line ends the block early — a common cause of “the rest of my config disappeared.”

YAML Validator vs yamllint (CLI)

yamllint is the canonical Python CLI tool for YAML checking and is what most teams add to CI. The two tools have different roles:

This online validatoryamllint (CLI)
SetupNone — open the pagepip install yamllint
Syntax errors
Style rules (line length, spacing, document markers)BasicConfigurable, strict
Custom rule filesNo.yamllint config
Best forQuick one-off checks, paste-and-goCI/CD pipelines, team-wide enforcement
PrivacyRuns entirely in your browserRuns locally

Use this validator when you want an answer in three seconds. Add yamllint to your CI when you want consistent style across a team. They’re complementary, not alternatives — many developers use both daily.

YAML vs JSON

FeatureYAMLJSON
ReadabilityMore readableMore verbose
CommentsSupported (#)Not supported
IndentationSignificantNot significant
Data typesAuto-detectedExplicit
Trailing commasNot applicableNot allowed
Multi-line stringsNative supportRequires \n

YAML is generally preferred for configuration files that humans edit frequently, while JSON is better suited for data exchange between systems and APIs. Many tools accept both formats, and you can convert between them with a JSON ↔ YAML converter.

YAML Best Practices

Use Consistent Indentation

Pick 2 spaces per level (the most common convention) and stick with it throughout your project. Configure your editor and linter to enforce this.

Quote Strings When Ambiguous

YAML auto-detects types, which can cause surprises. Values like yes, no, true, false, null, 1.0, and 3:00 are interpreted as booleans, null, floats, or sexagesimal numbers:

# Dangerous - interpreted as boolean true
country: Norway
uses_yaml: yes

# Safe - explicitly a string
country: "Norway"
uses_yaml: "yes"

This is known as the Norway problem: country code NO becomes the boolean false in older YAML 1.1 parsers. Modern YAML 1.2 fixed many of these, but most tools (including some Kubernetes tooling) still target 1.1 quirks.

Use Linting in CI/CD

Add YAML linting to your CI/CD pipeline using yamllint or a similar tool. This catches formatting issues before they reach production. A misconfigured YAML file in Kubernetes or Docker Compose can cause an entire deploy to fail or, worse, succeed in unexpected ways.

Validate Before Deploying

Always validate YAML configuration files before applying them to production systems. This online validator gives you instant feedback for one-off checks; for automated workflows, integrate a YAML linting step into your build pipeline. The combination — pre-commit checks locally, CI enforcement on every push — eliminates almost all YAML-related deploy failures.

Frequently Asked Questions

What is YAML?

YAML (YAML Ain't Markup Language) is a human-readable data serialization format commonly used for configuration files, deployment manifests, and data exchange. It uses indentation to represent structure, making it cleaner and more readable than JSON or XML for configuration purposes.

Why does my YAML fail validation?

Common YAML errors include using tabs instead of spaces for indentation (YAML only allows spaces), inconsistent indentation levels, duplicate keys at the same nesting level, missing colons after keys, and incorrect list syntax. This validator reports the specific error and line number so you can fix the issue without guesswork.

Can I use tabs in YAML?

No. The YAML specification explicitly forbids tab characters for indentation. You must use spaces only. Most code editors can be configured to insert spaces when you press the Tab key. This is the most common source of YAML validation errors.

What indentation should I use in YAML?

YAML allows any number of spaces for indentation, but you must be consistent within each level. The most common convention is 2 spaces per indent level. Some projects use 4 spaces. Whatever you choose, be consistent throughout the entire file.

Can I validate GitLab CI YAML files here?

Yes. Paste the contents of your `.gitlab-ci.yml` and the validator will catch syntax errors — wrong indentation, duplicate stage keys, missing colons, tab characters. It checks pure YAML syntax only; for GitLab-specific schema validation (allowed keywords, job dependencies, includes), use GitLab's own CI Lint tool inside your project. Most failures developers hit on push are syntax-level, which this tool catches in seconds.

Does this validator work for Kubernetes manifests?

Yes. Kubernetes manifests, Helm charts, and `kustomization.yaml` files are all YAML and validate the same way. The validator confirms the YAML is syntactically correct and parseable. For Kubernetes-specific schema checks (apiVersion, kind, required fields), pair it with `kubectl apply --dry-run=client -f file.yaml` after the syntax check passes.

How does this compare to yamllint command-line?

yamllint is a Python CLI tool that does both syntax checking and style linting (line length, document markers, indent rules). This online validator focuses on the most common syntax errors and runs instantly without installing anything. Use this for quick checks; integrate yamllint into your CI pipeline for enforced style rules across a team.

Can I check GitHub Actions workflow files?

Yes. `.github/workflows/*.yml` files are standard YAML, so the validator catches indentation, tab, and structural errors before you commit. For schema validation (valid `runs-on` values, action references, job needs), GitHub Actions itself reports those when the workflow runs — but catching syntax issues here saves a wasted commit-push cycle.

What does 'mapping values are not allowed here' mean?

This PyYAML/js-yaml error almost always means an unquoted value contains a colon followed by a space — for example `title: Chapter 1: Intro`. The parser reads the second colon as the start of a new key, which isn't allowed inside a value. Fix it by quoting the whole value: `title: "Chapter 1: Intro"`. The same applies to values with times (`10:30`), URLs, or Windows paths that include a colon.

Can I validate a YAML file with multiple documents (---)?

Yes. A single file can contain several YAML documents separated by `---`, which is common for Kubernetes manifests that bundle a Deployment, Service, and ConfigMap together. Each document is checked independently. A frequent mistake is forgetting the `---` separator between two documents, which silently merges them into one mapping and often shows up as a duplicate-key error.

Does this validator support YAML anchors and aliases?

Yes. Anchors (`&name`), aliases (`*name`), and merge keys (`<<:`) are accepted without false errors. These let you define a block once and reuse it across a config. The most common anchor mistake is referencing an alias that was never defined, or placing the anchor after the alias that uses it — anchors must appear first in the file. This is a syntax-level checker, so for full anchor-resolution and schema rules, pair it with your language's YAML parser.

Is my YAML data safe with this tool?

Yes. All processing happens entirely in your browser using JavaScript. Your YAML data is never sent to any server, never logged, and never leaves your machine — important when you're pasting CI configs, Kubernetes secrets, or anything else with infrastructure details.