YAML Formatter & Validator
Parse, validate, and beautifully format YAML documents.
What this tool does
YAML (YAML Ain't Markup Language) is a human-friendly data serialization standard commonly used for configuration files, CI/CD pipelines, and Kubernetes manifests. It relies on indentation rather than brackets or braces, which makes it more readable but also more fragile, since a single misplaced space can silently change the structure of the document.
This formatter parses YAML, validates the syntax, and re-emits it with consistent indentation and key ordering. It also surfaces parse errors with line and column numbers so you can quickly locate the offending character. The tool runs entirely in your browser, so sensitive configuration containing connection strings, API keys, or infrastructure details never leaves your machine.
Usage Example
# Kubernetes deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: web-app
labels:
app: web
spec:
replicas: 3
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: web
image: nginx:1.25
ports:
- containerPort: 80Common Edge Cases
- Tabs are not allowed for indentation, even though most editors allow them. A single tab will cause a parse error and may shift the entire document structure.
- Norway, yes, no, on, off produce boolean values in YAML 1.1, which can cause surprising type coercion. Always quote ambiguous strings: "NO", "yes", "true".
- Duplicate keys in mappings silently overwrite earlier values, which can mask configuration errors that would otherwise be caught by strict schemas.
- Multi-line strings using the pipe (|) and greater-than (>) indicators have different semantics: pipe preserves newlines, greater-than folds them into spaces.
- Anchors (&) and aliases (*) allow reference sharing but can create confusing structures when overused. Always prefer explicit values for clarity.
FAQ
- Is this YAML 1.1 or 1.2?
- The parser follows the YAML 1.2 specification, which fixes the boolean coercion issues present in 1.1. The only string values that parse as booleans are true, false, True, False, TRUE, FALSE.
- Can it validate against a JSON Schema?
- No. This tool only checks syntactic validity. For schema validation, use ajv, jsonschema, or language-specific validators like yamllint.
- Does it preserve comments?
- Yes. Comments starting with # are preserved in their original positions, though leading whitespace may be normalized to match the indent setting.