YAML Formatter & JSON Converter — Format YAML Free in Your Browser
Format and validate YAML, convert YAML to JSON and back. Runs entirely in your browser — your configuration files never leave your device. Free and offline.
YAML is the configuration language of modern infrastructure — Kubernetes manifests, Docker Compose files, GitHub Actions workflows, Ansible playbooks, and countless application configs. SimpleTools YAML Formatter formats, validates, and converts YAML to/from JSON, entirely in your browser.
What the YAML Formatter Does
Validation: Checks YAML syntax and reports errors with line numbers — a missing colon, incorrect indentation, or invalid YAML construct is caught immediately.
Formatting: Normalises indentation, quote styles, and multi-line string formatting to produce consistent, readable YAML.
YAML → JSON conversion: Convert YAML configuration to equivalent JSON — useful for APIs that accept JSON, for debugging, or for developers more comfortable with JSON.
JSON → YAML conversion: Convert JSON back to YAML — cleaner, more readable for configuration management.
Before and After: YAML Formatting
Before:
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
labels:
app: my-app
spec:
replicas: 3
selector:
matchLabels:
app: my-appAfter formatting:
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
labels:
app: my-app
spec:
replicas: 3
selector:
matchLabels:
app: my-appConsistent 2-space indentation, no extra spaces after colons, properly aligned nesting.
YAML Validation Rules
YAML has strict indentation rules and a few common pitfalls:
- Indentation matters: YAML uses spaces (not tabs) for structure — mixing causes parse errors
- Colon + space:
key: value— the space after the colon is required - String quoting: Values starting with special characters (
{,[,:,#) need quoting - Multi-line strings:
|for literal blocks,>for folded blocks — easy to mix up - Boolean trap:
yes,no,on,off,true,falseare all YAML booleans — quote them if you mean strings - Tabs forbidden: YAML does not allow tab characters for indentation
Features
- Syntax validation: Real-time validation with line/column error positions
- Format/beautify: Consistent indentation and normalised formatting
- YAML → JSON: Convert YAML to formatted JSON
- JSON → YAML: Convert JSON to clean YAML
- Minify YAML: Compact output for embedding in scripts or CLI commands
- Highlight mode: Syntax highlighting for keys, values, comments, and anchors
- Anchor/alias support: Handles
&anchorand*aliasYAML features - Multi-document YAML: Handles
---document separators
Why Process Config Files in Your Browser?
YAML configuration files often contain:
- Database connection strings with credentials
- API keys and secrets embedded in config
- Infrastructure topology revealing internal architecture
- Kubernetes secrets (though these should be managed by a secrets manager)
- CI/CD pipeline logic revealing deployment processes
Sending these to a cloud-based YAML tool is an unnecessary security risk.
✅ Your YAML never leaves your browser
✅ Works offline — format configs without internet
✅ No account or API key needed
✅ Free for files of any size
How It Works
The tool uses js-yaml — the most widely-used JavaScript YAML parsing library:
import yaml from 'js-yaml';
// Parse YAML to JavaScript object
const parsed = yaml.load(yamlString);
// Convert to JSON
const json = JSON.stringify(parsed, null, 2);
// Convert back to YAML
const reformatted = yaml.dump(parsed, { indent: 2 });The yaml.load() function validates and parses the YAML. Any syntax error throws an exception with a line/column reference. The yaml.dump() function re-serialises the parsed object to normalised YAML.
How to Use the YAML Formatter
- Visit simpletools.one/yaml-formatter
- Paste your YAML in the input panel
- Validation errors appear immediately in the error panel
- Click Format to normalise the YAML
- Click → JSON to convert to JSON
- Click → YAML (in JSON mode) to convert back to YAML
- Click Copy or Download to save the result
Common YAML Errors and Fixes
| Error | Likely Cause | Fix |
|---|---|---|
bad indentation of a mapping entry | Inconsistent spaces | Use consistent 2-space indentation throughout |
unexpected end of the stream | Unclosed block | Check for missing values or incomplete structures |
duplicated mapping key | Same key twice in an object | Remove or rename the duplicate key |
cannot read property | Tabs used for indentation | Replace all tabs with spaces (Editor: find \t, replace with ) |
unexpected token | Special char in unquoted string | Quote the value: key: "value: with colon" |
Use Cases
- Kubernetes YAML: Validate manifests before applying with
kubectl apply - Docker Compose: Format and validate
docker-compose.ymlbefore deploying - GitHub Actions: Debug workflow YAML indentation issues
- Ansible: Validate playbooks and role files
- Application config: Format and check app config files (
config.yaml,settings.yml) - API testing: Convert between YAML test data and JSON request bodies
Format and validate your YAML at simpletools.one/yaml-formatter — private, instant, and completely free.