Paste messy YAML and get back clean, consistently indented YAML — validated as it formats, with 2 or 4 space indentation and optional key sorting. Fast, secure, and entirely in your browser.
No installation, no signup. Results in milliseconds.
A YAML formatter parses your YAML, checks that it is valid, and rewrites it with clean, consistent indentation. Because YAML uses whitespace to express structure, a single stray space or a tab can change the meaning of a file or break it entirely. Formatting normalizes all of that so the file is both correct and readable.
This tool does not blindly shift lines. It fully parses the YAML into data and re-serializes it, so the output is guaranteed well-formed. If the input cannot be parsed, you get the error instead of a silently broken file.
Most YAML errors come from a handful of whitespace rules. The formatter enforces all of them.
| Rule | What it means |
|---|---|
| Spaces only | Indentation must use spaces. Tabs are not allowed and are a common cause of errors. |
| Consistent width | Every nesting level uses the same number of spaces (this tool outputs 2 or 4). |
| Nesting by indent | A child key is indented further than its parent; siblings share the same indent. |
| List items | A - marks each list item, indented under its key. |
| Space after colon | A mapping needs key: value with a space after the colon. |
The error you see most often is bad indentation of a mapping entry, which means a line is indented in a way YAML cannot interpret, often because tabs crept in or a nested block is under-indented. Formatting rewrites the whole file to even spacing, so the error disappears. A could not find expected ':' error usually means a missing colon or a value that needs quoting. If your data started as JSON, remember that all valid JSON is valid YAML, so you can paste JSON here and format it as YAML, or go the other way with the JSON to XML and other converters.
See how the formatter turns an inconsistently indented config into clean, valid YAML.
Every level is now a clean two spaces, the list item sits one level under ports, and the inconsistent four and eight space indents are gone. Because the tool parses then re-dumps, you also know the file is valid. For the rules behind this, read our guide on how to format YAML.
YAML runs modern infrastructure, and indentation is everything.
Everything developers ask about formatting YAML.
Hands-on articles from our blog.
All free, all browser-based, no signup required.