Free online YAML formatter and trap finder
YAML formatter that points at the tab
Paste a config and it comes back on one indentation width — free, no signup, up to 5 MB — with every value copied across exactly as you wrote it, because in YAML changing a value’s punctuation changes its type. Alongside the output it names the things that actually break these files: a tab in the indentation, which no parser will accept; a bare no or on, which YAML 1.1 readers turn into a boolean; a key set twice in one mapping; a number that is octal in disguise. Block scalars and multi-line flow collections are reproduced character for character rather than guessed at.
- 100% free
- No signup
- Up to 5 MB
- Tabs located
- Values never re-typed
The re-indented document appears here.
Paste YAML, drop a file, or press Ctrl+V anywhere on this page.
How to format a YAML file
Paste, pick a width, read the warnings before you copy.
Paste the file that will not load
Put it in the left panel, use ⌘V or Ctrl+V with nothing else focused, or open a .yml from disk. A docker-compose file indented with four spaces in one half and two in the other is the usual arrival; so is a GitHub Actions workflow that a text editor has quietly filled with tabs.
Choose a width and what to line up
Two spaces or four, dashes indented under their key or flush with it, and optionally every value in a block padded to the same column. Quotes have their own setting: leave them alone, drop them where the value stays a string, or convert between single and double. Quotes are never added to a bare value, because that would change its type.
Read the warnings before you copy
The panel underneath lists what would surprise you: the line with a tab in its indentation, the value that YAML 1.1 reads as false, the key set twice in one mapping, the number that is octal in disguise. Red means no parser will read the file at all; amber means it will read it as something other than what you meant. Then Copy, or Download as .yaml.
Technical specifications
| What is re-indented | Block mappings and block sequences, to 2 or 4 spaces, with dashes flush to their key or indented one level; nesting is rebuilt from the structure rather than by shifting lines |
|---|---|
| What is copied verbatim | Block scalar bodies under | and >, multi-line flow collections, explicit key syntax (? key), plain scalars continuing onto a following line, and any block whose header carries an explicit indentation indicator such as |2 |
| Values | Never re-typed and never re-encoded — 1.10 stays 1.10, 0755 stays 0755, key order is the file's order. Quotes may be converted between single and double, or removed where the value remains a plain string; they are never added to a bare scalar |
| Traps reported | Tab characters in indentation, the 16 words YAML 1.1 resolves to booleans, duplicate keys within one mapping, octal-looking integers, trailing whitespace and CRLF line endings — each with its line number |
| Tabs | Reported always; with “Convert tabs” on, leading tabs are expanded to the chosen indent. With it off the document is returned untouched, because a file no parser accepts should not be half-repaired |
| Alignment | Optional: within each run of adjacent single-line entries, keys are padded so the values start in one column. Runs are broken by a blank line, a nested block or a sequence |
| Not supported | Anchors, aliases and tags are carried through on their line but never expanded or merged; << merge keys are not resolved; the document is not validated against a schema and no value is checked for type |
| Throughput and price | 1,802 keys and 300 sequence items across 45.7 KB re-indented in 3 ms; 5 MB per document; no signup and no charge, with the file read inside your browser |
Frequently asked questions
Why does YAML break when I use tabs?
Because the specification forbids tab characters in indentation outright, and no parser will accept them. The reason is that indentation in YAML is counted in columns and a tab has no fixed width — one file would nest differently depending on whether it was read with a tab of two, four or eight, so the format simply outlaws the character rather than picking a number. Tabs are legal inside a scalar value, which is why the error you get points at a line that looks fine. This page names every offending line, and the “Convert tabs” switch expands the leading tabs to your chosen indent so the file can be read at all; with it off, the document is handed back untouched rather than half-fixed.
Why did my value `no` turn into false?
Because YAML 1.1 resolves 16 different words to booleans — y, n, yes, no, on and off in several capitalisations — and most of the world is still running 1.1 parsers. PyYAML, Ruby's psych and Go's gopkg.in/yaml.v2 all read `country: no` as `country: False`, which is the reason the Norway problem has its own name. YAML 1.2 narrowed the core schema to true and false only, so newer readers such as yaml.v3 and the JavaScript yaml package leave `no` alone — and that split is worse than either rule, because the same file now means two things. The fix is to quote it: "no" is a string in every version. This page flags each of the 16 rather than changing your value for you.
Can this formatter reorder or change my values?
No. Every scalar is copied across as the characters you wrote, so a version pinned as 1.10 does not become 1.1, a leading zero survives, and key order is exactly the order in the file. What moves is the indentation, the spacing after a colon and, if you ask for it, the quote style — and even then quotes are only ever converted or removed, never added, because wrapping a bare 8080 in quotes would turn an integer into a string. A formatter for a format where indentation is meaning has to be more conservative than one for JSON, not less.
Should sequence dashes be indented under their key?
Both are valid, and the file parses identically either way. Putting the dash flush with its key is what the YAML specification's own examples do and what Kubernetes manifests usually look like; indenting it one level is what Prettier, docker-compose documentation and most editors produce, and it makes the nesting easier to follow when a sequence holds mappings that hold more sequences. Pick one and apply it to the whole repository — the switch here exists so you can normalise a file that has been edited by people who chose differently.
What happens to my multi-line block scalars?
The body is preserved down to the last space, and only the block as a whole is shifted. Everything under a `|` or `>` header is data — a shell script, a certificate, an embedded config — so relative indentation inside it is kept exactly and the whole block moves together to sit under its key. The one case that is not touched at all is a header carrying an explicit indentation indicator such as `|2`, because the number in the header counts columns from the parent: move the block and the number becomes a lie. Those blocks are copied out verbatim and noted in the panel.
Does it tell me if my YAML is invalid?
It reports the failures it can see from the structure — tabs in indentation, duplicate keys in one mapping, values a YAML 1.1 parser will re-type — but it is not a full validator and does not pretend to be. It reads the block structure line by line rather than building a document model, which is exactly what lets it re-indent a file a strict parser would reject outright, and which is also why it cannot tell you that an anchor points at nothing. For a yes-or-no verdict with the line the parser stopped on, the YAML validator on this site does that job.
Why are my inline lists and objects left alone?
Because a flow collection spread over several lines has its own continuation rules, and re-indenting it means re-deciding where each item sits. A `[1, 2, 3]` written on one line is a scalar-shaped value and is copied through as it stands; the same list broken across four lines is taken as a region and reproduced exactly, with a note saying so. The same applies to explicit key syntax (`? key`) and to a plain scalar that continues onto a following line — three constructs where guessing would be worse than leaving them be.
About YAML indentation and its traps
YAML is the only format on this site where whitespace is not decoration but syntax. Indentation decides what is nested inside what, so a formatter here cannot do the obvious thing that a JSON or CSS formatter does — parse into a model and print it back out — without taking on the risk of rebuilding the document differently from the way any given parser would read it. What this page does instead is read the block structure line by line, work out the tree from the column of each key, and re-emit that tree at the width you asked for, carrying every scalar across as characters. Nothing is re-typed on the way through, which is why a version pinned at 1.10 comes back as 1.10 rather than as 1.1.
The traps are worth knowing individually, because they fail in different ways. Tabs fail loudly: the specification bans them from indentation because a tab has no defined width, so a document indented with them would nest differently for different readers, and every parser refuses the file. The boolean words fail quietly: YAML 1.1 resolves y, n, yes, no, on and off to booleans, YAML 1.2 narrowed that to true and false, and the ecosystem never finished migrating — PyYAML and Ruby's psych still follow 1.1, Go's yaml.v3 and the JavaScript yaml package follow 1.2, so the same two-character value means different things to the two services reading the same file. Duplicate keys fail invisibly: the specification says a mapping must not have them, most implementations keep the last one and say nothing, and the setting you edited at the top of the file was overridden forty lines down. Octal is the fourth: an integer written 0755 is base eight under 1.1, so a file mode arrives as 493.
When the question is not layout but whether the document parses at all, the YAML validator gives a verdict and a line number. When you need the same data somewhere that has no YAML support, the YAML to JSON converter resolves the anchors and aliases this page carries through untouched — and once it is JSON, the JSON formatter takes over.
Where your configuration is read
Everything happens in this browser tab, and nothing about the file is sent anywhere. Worth saying for this format in particular: the YAML that ends up in a formatter is usually a deployment manifest or a CI workflow, so it tends to carry hostnames, bucket names, image tags — and now and then a credential nobody meant to commit. None of that is transmitted, and shutting the tab disposes of it.