YAML Formatter & Validator
Validate YAML and re-format it with consistent indentation.
This tool runs entirely in your browser. Your data is never uploaded, never stored, and never leaves your device.
YAML pasted here is parsed to check that it is well-formed and then written out again with consistent indentation, turning a hand-edited file with ragged spacing and inline collections into one canonical shape.
How to use it
- 1Paste the YAML into the top box.
- 2Press Validate for a straight pass or fail, or Format to have it rewritten.
- 3Set the indent to 2 or 4 spaces before formatting, then copy the output.
Example
- Input
- name: example items: [one, two]
- Output
- name: example items: - one - two
The flow sequence becomes an indented block list because the output is written afresh from the parsed data, not patched in place.
What happens to your data
Parsing and emitting are both done by js-yaml bundled into the page: loadAll walks every document in the stream and dump rewrites each one, joined back with a --- separator. Because that round-trip goes through plain JavaScript values, comments are dropped and anchors come back as the value they pointed at — and when it fails, the YAMLException you see, complete with line, column and the offending line marked by a caret, is rendered in your own tab and reported nowhere.
Last updated August 2026
A build step has just failed on a config file that looked fine in your editor, or you have opened a values file that three people edited with three different indent settings. That is what usually brings someone to a YAML formatter — not a wish for tidier text, but a parser somewhere that has already said no.
Decide first which of two jobs you want done. One is reformatting a file in place, keeping the comments and the anchor names the authors wrote, which needs an editor plugin or a round-trip library that holds on to the original tokens. The other is re-emitting the file from whatever the parser understood it to mean, which discards everything that was decoration and gives you one canonical shape. This tool does the second, which matters most for files people maintain by hand: a Helm chart or a CI workflow carries much of its explanation in comments.
The mistake underneath most broken YAML is not indentation but typing. Unquoted scalars are interpreted before your program sees them, so a country code of NO, a version of 1.10 and an account number with a leading zero are not the strings you meant, and no amount of reformatting recovers the intent. Quote anything that is text and only looks like something else.
Two rules the format enforces strictly are worth knowing before you paste: a tab may never be used for indentation, and repeating a key inside one mapping is an error rather than a last-one-wins overwrite.
How it works
Toolvore parses the whole stream before it writes anything, so validating and formatting are the same pass with the output suppressed — a file that fails gives you no formatted text at all, and you fix errors one at a time, because parsing stops at the first. What comes back is written from the parsed values rather than edited from your text, and several things about it are decided for you. Sequences are indented underneath their parent key, so if your house style puts the dash flush with the key the output will not match, and there is no setting for it. Key order follows JavaScript object rules, which means keys that look like whole numbers move to the front in numeric order wherever you wrote them. Strings longer than about a hundred columns are folded across lines as a block scalar, and an empty value becomes an explicit null. Text you wrote with a pipe stays a literal block with its line breaks intact.
Common use cases
- Tidying a Kubernetes manifest before a pull request
- Checking a GitHub Actions workflow parses before you push
- Locating the line a parser error points at
- Normalising indentation across files written by several people
- Confirming a multi-document stream splits where expected
Frequently asked questions
What is the difference between YAML and JSON, and when should I use each?+
Every JSON document is also valid YAML, and YAML adds comments, multi-line strings, anchors and a layout that leans on indentation instead of brackets. That makes it pleasant to hand-edit, which is why configuration ended up living there. It also makes it easy to break: whitespace carries meaning, so a stray space changes the structure silently. JSON has no comments and less ambiguity about types, which is why it wins for data moving between programs. A workable rule is YAML for files humans write and read, JSON for anything generated and consumed by a machine.
Why do some values change meaning if I leave them unquoted?+
A bare scalar is interpreted before your program ever sees it. The best-known case is a country code of NO, read as the boolean false by parsers following YAML 1.1, along with y, n, on and off. Numbers bite more often now: a version written as 1.10 becomes the number 1.1 with the zero gone, an identifier with a leading zero loses it, and an id longer than about sixteen digits can lose precision. A bare date may be read as a date rather than as text. Quote anything that is meant to stay a string.
Why has the output put quotes around values I wrote plainly?+
That is the emitter protecting the meaning it just read. Where a string would otherwise be read back as something other than a string — the word yes, a time such as 12:30, a date, a country code — it is wrapped in single quotes so the next parser gets the same value you had. Strings that could not be mistaken for anything else are left bare, and quotes that were doing no work are dropped. The result can look noisier than what you pasted, but it is the text that survives another round trip.
What does the error duplicated mapping key mean?+
You have used the same key twice inside one mapping, and it is an error rather than a silent overwrite. That rejection is worth being grateful for, because the alternative — one parser keeping the last value and another keeping the first — is a bug that only appears in one environment. The usual causes are a merge that added a key someone had already added further down a long file, or a copied block pasted under the wrong parent. The message names the line and column, so remove or rename whichever of the two is stale.
Why can I not use tabs to indent YAML?+
The specification forbids tab characters in indentation outright, and parsers report it rather than guess, because a tab has no fixed width and the meaning of a file would depend on whoever opened it. This is the most common surprise for anyone whose editor inserts tabs by default, and it is invisible on screen. Set the editor to insert spaces for .yaml and .yml files, which most support as a per-language setting, and switch on whitespace rendering while you hunt for the one that got in. Tabs inside a quoted string are fine — only indentation refuses them.
Where does my YAML go when I paste it into a page like this?+
Nowhere. The parser is a JavaScript library bundled into the page itself, so the check and the rewrite both happen inside your own tab: there is no upload and no request, and the error text that quotes your offending line back at you is produced and shown locally too. Nothing is retained either, because the text lives only in the page while the tab is open and a refresh clears it. That matters more than usual with YAML, since configuration files are exactly where connection strings, tokens and keys tend to sit.
How do I reformat YAML without losing my comments?+
You need a formatter that edits the text rather than rebuilding it. Comments are not data — no parser hands them to your program — so anything that loads a file into ordinary values and prints those values back out drops every one of them, along with blank lines and the grouping they created. Tools that keep comments work on the parse tree instead: an editor formatter such as Prettier, or a round-trip library like ruamel.yaml in Python. Keep a copy of anything you care about before running it through a formatter that rebuilds.
What does the three-dash line mean in a YAML file?+
It starts a new document, and one file can hold as many as you like — the reason a single file can describe a deployment, a service and an ingress for kubectl. Three dots alone on a line ends a document explicitly, which is rarer. A leading three-dash line at the top of a file is optional. What matters is that each document is parsed on its own, so a key repeated across two documents is not a duplicate, and a tool that reads only the first will quietly ignore the rest.
Related tools
JSON Formatter & Validator
Format, validate, and minify JSON documents.
Cron Expression Parser & Builder
Build cron expressions and see their next run times explained.
QR Code Generator
Generate a downloadable QR code from any text or URL.
URL Parser
Break a URL into protocol, host, path, and query parameters.