tool
YAML Formatter & Validator
Fix messy indentation, catch tabs and unclosed brackets, and tidy config files for Docker, Kubernetes and CI.
paste your code and choose format
Validate and format YAML config files
YAML runs a huge amount of modern infrastructure: Docker Compose files, Kubernetes manifests, GitHub Actions and GitLab CI pipelines, Ansible playbooks, OpenAPI specs and countless app configs. It's also easy to break with one wrong indent. Paste your YAML to check it for syntax errors, including tabs, inconsistent indentation, misplaced list items and unclosed brackets, and to re-format it with clean, two-space indentation. Comments, anchors and multi-document files are preserved, and the YAML never leaves your browser.
What can you do?
- 1. Find YAML syntax errors
Get the line and column of the first problem, such as “Line 4, column 1: All mapping items must start at the same column” or “Tabs are not allowed as indentation”. - 2. Re-indent consistently
Normalise nested maps and lists to two-space indentation, tidy spacing after colons and in flow collections like [ "3000:3000" ]. - 3. Keep comments and structure
Comments stay where they are, and anchors (&base), aliases (*base), merge keys (<<) and block scalars (| and >) are kept intact. - 4. Multi-document support
Files containing several documents separated by --- (common in Kubernetes manifests) are validated and formatted document by document.
Why validate YAML before you deploy?
In YAML, indentation is structure. A key that is one space off becomes part of a different object, or makes the whole file invalid, and the error message from a deployment tool often points somewhere else entirely. Tabs are not allowed for indentation at all, yet many editors insert them.
Checking the file before you commit or apply it turns a failed pipeline or a crash-looping container into a ten-second fix. Formatting it consistently also makes reviews and diffs much easier to read.
How to validate a YAML file
- 1. Paste the YAML
Paste a docker-compose.yml, a Kubernetes manifest, a workflow file or any other YAML document. - 2. Click validate
If the YAML is valid you'll see a success message; if not, the first error is shown with its line and column. - 3. Fix and repeat
Correct the reported line and validate again until the file passes. - 4. Format if you like
Click format for consistently indented output, then copy it back into your repository.
Example: fixing a docker-compose.yml
This Compose file uses four-space indentation, single quotes and extra spaces. After formatting it uses two spaces, double quotes and tidy flow lists, and the comment is preserved:
Common YAML errors and how to fix them
| Error message | Typical cause | Fix |
|---|---|---|
| All mapping items must start at the same column | Sibling keys indented by different amounts | Line up sibling keys at exactly the same column |
| A block sequence may not be used as an implicit map key | A list item (- x) indented less than the items above it | Indent every item of a list by the same amount |
| Tabs are not allowed as indentation | A tab used for indentation | Replace tabs with spaces |
| Flow sequence in block collection must be sufficiently indented and end with a ] | An unclosed [ list | Add the missing ] |
| Nested mappings are not allowed in compact mappings | A value like key: other: value on one line | Quote the value or move it to its own indented line |
YAML gotchas a validator can't catch
Some YAML is perfectly valid but doesn't mean what you think. Watch for these in config files:
- Duplicate keys
A key that appears twice in the same mapping is accepted by the formatter, and many YAML parsers silently keep only the last value. Search for repeated keys when a setting seems to be ignored. - Unquoted values that change type
Under YAML 1.1 rules, still used by many tools,NO,offandyesbecome booleans, and a version like3.10is the number 3.1. Quote values such as country codes and versions:"NO","3.10". - Port mappings and times
Docker's documentation recommends quoting port mappings like"22:22", because unquoted colon-separated numbers can be read as base-60 numbers by YAML 1.1 parsers. - Schema errors
A misspelled Kubernetes field or a GitHub Actions key in the wrong place is valid YAML. Use the platform's own schema validation (kubectl --dry-run, actionlint, docker compose config) for those.
Frequently asked questions
Does formatting change my data?
No. Values, keys and their order stay the same. The formatter changes indentation, spacing and quote style (preferring double quotes), and keeps comments.
Can I convert YAML to JSON here?
Not with this tool, which formats and validates YAML only. If you already have JSON, the JSON formatter can validate and pretty-print it.
Is .yml different from .yaml?
No. Both extensions are the same format. Docker Compose, GitHub Actions and most tools accept either.
Why can't I use tabs?
The YAML specification forbids tab characters for indentation to avoid ambiguity between editors with different tab widths. Configure your editor to insert spaces in .yml and .yaml files.
Is it safe to paste files that contain secrets?
The YAML is processed in your browser and isn't uploaded or stored. As a good habit, still remove passwords and tokens before pasting config files into any website.
Related tools
Config in JSON instead? Validate it with the JSON formatter. Comparing two versions of a manifest? Paste both into the diff checker.
- JSON Formatter & Validator – Pretty-print, validate and minify JSON.
- XML Formatter, Validator & Minifier – Pretty print, validate and minify XML, SVG and RSS.
- Markdown Formatter – Give README and docs files a consistent Markdown style.
- Diff Checker – Compare two versions of text or code line by line.