About YAML Formatter
Tidy and check YAML in one step. Paste a config file, such as a Docker Compose, Kubernetes or CI file, and the tool re-indents it consistently, keeps your comments and reports the exact line and column of any syntax error. It reads YAML 1.2, supports several documents separated by ---, and can sort the keys alphabetically.
How to use YAML Formatter
- Paste your YAML or open a .yaml or .yml file.
- Choose 2 or 4 spaces of indentation and, if you want, tick Sort keys A–Z.
- Read the formatted result, or the error with its line and column.
- Copy the output or download it as formatted.yaml.
Tips and good to know
- Tabs are not allowed for indentation in YAML; the error message will point at the line that uses one.
- Sorting keys moves a comment together with the entry it is attached to, so a comment above a key may end up somewhere new.
- Quotes can be normalised and long flow lists may be rewritten as { a, b }, but values are never re-typed: the text 007 stays text.
Indentation rules in YAML
YAML uses spaces for structure; tabs aren't allowed for indentation. Every item at the same level must be indented by exactly the same amount, and lists start with a dash followed by a space. A single wrong indent can move a key under a different parent without any error, which is a common cause of broken CI pipelines, Kubernetes manifests and Docker Compose files. Two spaces per level is the most common convention.
Quoting strings that contain colons, hashes or leading special characters such as * and & avoids surprises, because those symbols mean something in YAML.
Frequently asked questions
Does it keep my comments?
Yes. Comments are preserved, including end-of-line comments. Only blank-line spacing and indentation are normalised.
Which YAML version does it follow?
YAML 1.2 with the core schema, so words such as yes, no and on stay plain text instead of becoming booleans, as they do in older YAML 1.1 parsers.
Is YAML Formatter free?
Yes. YAML Formatter is free: no sign-up, no paid plan, no trial and no limit on how often you use it. It runs in your browser, and ToolzAura is paid for by ads, so every tool stays free.
Are my files uploaded?
No. This tool runs in your browser, so your input stays on your device.