YAML is the default configuration format for Docker Compose, Kubernetes, CI/CD pipelines, and Ansible, and the YAML formatter is built around the question of making those files readable again. Paste any YAML document, choose one of the two modes, and the tool re-emits the whole document with consistent spacing, entirely inside your browser. Nothing is stored and nothing is uploaded; the parser and the serializer both run on your machine.
Paste YAML and pick a mode
There is no live reformatting: the document is processed only when you press a button. Format is the default mode and rebuilds the document in block style, the one key per line layout most configuration files use. Minify targets a different goal, producing the most compact representation the parser can still read. A small indent selector switches Format between 2-space and 4-space indentation; it appears only in Format mode because Minify always uses 2 spaces.
What Format does: one clean block-style document
Format normalizes every level of the document to the indentation you chose. Nested mappings and sequences line up at fixed offsets, trailing spaces disappear, and one level always equals one indentation step. Long values are never wrapped: a value that is 400 characters long stays on a single line, because in configuration files the readability of the structure matters more than line length.
What Minify does: flow style under a block top level
Minify does not collapse the document into a single line, and that surprises people. The top level stays in block style, but every value under a top-level key is written in flow form: a list of strings becomes items: [a, b], and a nested mapping becomes a: {b: [1, 2]}. A top-level list of maps becomes one flow map per line, starting with a dash and an opening brace. Values that could be misread in flow, such as a key named y, get quoted to keep the meaning exact.
What the formatter drops and rewrites
Three things are worth knowing before you diff the output. Comments are dropped: the parser turns the document into a data structure first, and comments do not survive that step. Anchors and aliases are understood while parsing, but the serializer is configured not to emit references, so every alias comes back as a full copy of the value it points to. Numbers are normalized too: 3.0 becomes 3, 1e5 becomes 100000, 0x10 becomes 16, and empty values, tildes, and null all print as null while an empty string stays an empty string, quoted.
Key order: kept, with one exception
The formatter does not sort your keys. String keys keep exactly the order they had in your document, so a file that lists zebra, ant, and m comes back in that same order. There is one exception that can look like sorting: a key that looks like an integer, for example 123, moves to the front of the mapping. That is not the formatter choosing an order; it is how the JavaScript object holding the parsed document lists its properties, and integer-like keys are always first.
Error messages with line and column
Invalid YAML does not produce a vague failure. The parser reports the problem with a line and a column number, both starting at 1, so you can jump straight to the broken spot. Duplicate keys are rejected the same way, which is useful when a copied block sneaks in twice. One case is different: a second document marker in the input is also an error, but that message has no position, because the parser stops at the stream level. Pasting nothing at all shows its own dedicated message.
Swap, clear, and where to go next
Two small controls finish the workflow. The Swap button appears once there is output and copies it back into the input, clearing the output, which makes iterative fixing fast: format, notice a value you want to rework, swap, edit, format again. Clear empties both sides and the error line. Nothing on the page is stored, so sensitive configuration content never leaves your browser. If your data starts life as JSON, run the JSON Formatter first or go straight to the JSON/YAML Converter. XML configurations get the same treatment in the XML Formatter, and for markup files the HTML formatter walkthrough covers the same format-and-minify pattern with protected script blocks.