YAML Editor & Validator
Validate, format, minify, and explore YAML with a live tree view and path copy
Parsing…
Tip: In the Tree View, hover any node and click its path badge to copy the full dot-notation path.
Your Kubernetes deployment manifest has a syntax error — kubectl apply says “error parsing YAML” but doesn’t tell you which line has the wrong indentation. You need an editor that shows real-time validation with line and column numbers, so you can find the misaligned key or missing colon immediately.
Why This Editor (Not the YAML Validator)
PureDevTools has a YAML Validator for quick validation with error details. This tool is a full-featured YAML editor — real-time validation, auto-format, minify, interactive tree view, path copy, type indicators, sort keys, and comment preservation. Use the validator for quick checks; use this editor for writing and debugging YAML files.
YAML Editor & Validator — Full-Featured Browser Tool
YAML (YAML Ain’t Markup Language) has become the configuration standard for virtually every modern developer tool: Docker Compose, Kubernetes manifests, GitHub Actions, Ansible playbooks, and dozens of CI/CD platforms. Yet debugging YAML is notoriously painful — whitespace-sensitive syntax, ambiguous scalar coercion, and cryptic parser errors make even small mistakes hard to find.
This free online YAML editor solves those problems. It provides real-time syntax validation, automatic formatting, minification, and an interactive tree view — all processing happens entirely in your browser with no data sent to any server.
Core Features
Real-Time Syntax Validation
As you type, the editor validates your YAML against the YAML 1.1/1.2 specification. Errors are reported with precise line and column numbers so you can jump directly to the problem. Common errors detected include:
- Tab characters in indentation — YAML requires spaces only; tabs are explicitly forbidden
- Unclosed quoted strings — both single (
') and double (") quoted strings - Unclosed flow sequences —
[without matching] - Unclosed flow mappings —
{without matching} - Invalid indentation — keys at inconsistent indent levels
Auto-Format / Prettify
Click Format to normalize your YAML into clean, consistently indented output. You can choose between 2-space and 4-space indentation. The formatter:
- Normalizes whitespace and indentation
- Preserves the original key order (or sorts keys alphabetically with the Sort Keys option)
- Handles block scalars (
|literal,>folded), flow sequences, and flow mappings - Optionally re-injects comments from the original YAML at their associated keys
Minify (Compact Output)
Click Minify to collapse your YAML into the most compact flow-style representation, with no newlines or extra whitespace. This is useful for embedding YAML values inside other formats or reducing file size. Minified output uses YAML flow syntax: {key: value, list: [1, 2, 3]}.
Interactive Tree View
The tree view renders your YAML document as an expandable, collapsible node hierarchy. Each node displays:
- The key name (for object properties) or index (for array items)
- A type badge:
string,number,boolean,null,array, orobject - The value for scalar nodes
- A copy path button — click any node to copy its full dot-notation path (e.g.,
server.database.port) to your clipboard
The tree view updates live as you edit, making it easy to explore large YAML files and verify structure.
Path Copy
Every node in the tree view has a clickable path indicator. Clicking it copies the full dot-notation path to your clipboard — for example, clicking port inside server.database copies server.database.port. Array items use bracket notation: services[0].image. This is particularly useful when writing code that reads YAML values via libraries like PyYAML, js-yaml, or yq.
Type Indicators
Each scalar value in the tree view shows its inferred YAML type:
| YAML Value | Type | Notes |
|---|---|---|
hello | string | Unquoted plain scalar |
"world" | string | Quoted string |
42 | number | Integer |
3.14 | number | Float |
true / false | boolean | YAML boolean (also: yes/no, on/off) |
null / ~ | null | YAML null |
- item | array | Sequence |
key: value | object | Mapping |
Sort Keys
Enable Sort Keys to output keys in alphabetical order, making large YAML files easier to compare and diff. Sorting is applied recursively to all nested mappings. Array order is preserved (arrays have meaningful order).
Comment Preservation
When formatting with Preserve Comments enabled, the tool extracts comment lines from your original YAML and re-injects them before their associated keys in the formatted output. This preserves section headers and inline documentation through format operations. Comments are always stripped during minification (minified output is comment-free by design).
YAML Syntax Reference
Mappings (Objects)
# Simple mapping
name: Alice
age: 30
active: true
# Nested mapping
server:
host: localhost
port: 8080
tls: false
Sequences (Arrays)
# Inline sequence
colors: [red, green, blue]
# Block sequence
fruits:
- apple
- banana
- cherry
# Sequence of mappings
services:
- name: web
port: 80
- name: db
port: 5432
Scalars
# Strings (quoted when necessary)
plain: hello world
quoted: "value with: colon"
single: 'it''s a string' # single-quote escaped with ''
# Numbers
integer: 42
float: 3.14
hex: 0xFF
# Booleans
enabled: true
disabled: false
# Null
missing: null
also_null: ~
Block Scalars
# Literal block (preserves newlines)
description: |
Line one.
Line two.
Line three.
# Folded block (newlines become spaces)
summary: >
This is a long description
that wraps across multiple lines
but becomes a single paragraph.
Anchors and Aliases
# Define an anchor
defaults: &defaults
timeout: 30
retries: 3
# Reuse with alias
production:
<<: *defaults
host: prod.example.com
staging:
<<: *defaults
host: staging.example.com
Common YAML Errors and Fixes
Tab Character Error
Error: Tab character in indentation
Cause: YAML requires spaces for indentation; tabs are not allowed anywhere in the indentation.
Fix: Replace all tab characters with spaces. Most editors have a “convert tabs to spaces” option.
Mapping Values Not Allowed
Error: Mapping values are not allowed here
Cause: Usually a missing space after the colon: key:value instead of key: value.
Fix: Add a space after every colon that separates a key from its value.
Indentation Error
Error: Bad indentation or Could not find expected ':'
Cause: A child key is indented differently than its siblings, or a list item has inconsistent indentation.
Fix: Ensure all keys at the same level use the same number of spaces. Do not mix 2-space and 4-space indentation in the same file.
Unexpected Characters
Error: Unexpected character
Cause: Special characters like :, #, {, }, [, ] in unquoted strings.
Fix: Quote the value: title: "Value with: colon" or use a block scalar.
YAML vs JSON
YAML is a superset of JSON (JSON files are valid YAML), but YAML adds:
- Comments (
#) — JSON has no comment syntax - Block scalars — multi-line strings with literal or folded style
- Anchors and aliases — DRY reuse of repeated structures
- Unquoted strings — most values don’t need quotes
- Multiple document support —
---separator for multiple documents in one file
For configuration files, YAML is generally preferred. For API communication and data storage, JSON is more portable.
Use Cases
DevOps Engineers — Validate Kubernetes manifests, Docker Compose files, Helm charts, and CI/CD pipeline definitions before committing them.
Developers — Format messy YAML configuration files, inspect structure with the tree view, and copy precise property paths for use in code.
Data Engineers — Validate Airflow DAG configurations, dbt project files, and MLflow experiment configs.
Technical Writers — Format YAML examples for documentation and verify they are syntactically correct.
Privacy
All YAML processing — parsing, validation, formatting, minification, and tree rendering — runs entirely in your browser using JavaScript. No YAML content is ever transmitted to any server. Your configuration files, secrets, and credentials remain on your machine.
FAQ
Q: Does this tool support YAML 1.1 or YAML 1.2?
A: The parser handles most YAML 1.1 features used in real-world configuration files, including anchors/aliases, merge keys (<<), block and flow scalars, and standard type coercions. YAML 1.2 features like octal literals with 0o prefix are handled as strings.
Q: Can I validate multi-document YAML (files with ---)?
A: The tool parses the first document in a multi-document YAML stream. Documents after the first --- separator are not validated separately.
Q: Why does minifying my YAML produce JSON-like output?
A: Minified YAML uses flow style ({key: value}) which is valid YAML that also happens to be similar to JSON. This is the standard way to produce compact YAML — it is fully YAML-compliant.
Q: Are comments preserved when formatting?
A: Enable the Preserve Comments toggle before clicking Format. With it on, the tool extracts comments from your original YAML and re-injects them before their associated keys. Comments preceding document-level keys are always preserved; inline comments (after values on the same line) may be repositioned to the line above.
Q: Can I use this to validate Kubernetes YAML?
A: Yes, for YAML syntax validation. This tool validates YAML structure and syntax. It does not validate Kubernetes-specific schemas (API versions, resource types, required fields). For full Kubernetes schema validation, combine this tool with kubectl --dry-run or kubeval.