Format, beautify and validate YAML files instantly with syntax highlighting, detailed error detection and support for modern YAML configurations. Everything runs locally in your browser.
valid
Input
698
Formatted
0
The result appears here as you type.
Valid YAML
0 documents, no problems found. Indentation is consistent, keys are unique and every alias resolves.
0 keys · 0 objects · 0 arrays · depth 0 · 0 B
0 errors · 0 warnings · <1 ms
Formatted in your browser — nothing is uploaded.
Everything happens locally in your browser. Your YAML files are never uploaded.
What is YAML?
YAML is a data format designed to be written and read by people. It carries the same shapes as JSON — mappings, sequences, scalars — but expresses nesting with indentation rather than brackets, and it allows comments.
That difference is why nearly every configuration format of the last decade chose it: Kubernetes, Docker Compose, GitHub Actions, GitLab CI, Ansible, Helm. These are files people edit by hand, and comments explaining why a value is what it is matter more than parsing speed. A scheduled job in one of them is still a bare cron expression inside a YAML string, with nothing in the file to say what it means.
The cost is that YAML is genuinely complicated. It has six ways to write a scalar, two collection styles, anchors and aliases, tags, multiple documents in one file, and typing rules that guess what you meant. Most YAML problems come from that last one.
What is a YAML formatter?
A YAML formatter rewrites a file with consistent indentation, spacing and quoting, without changing what it means. The document that comes out holds exactly the data that went in.
Why it matters more in YAML than in most formats: indentation is the structure. In JSON a stray space is invisible; in YAML it decides which block a key belongs to. Consistent formatting is how you see that a key is nested one level deeper than you thought.
It also makes diffs honest. When everyone’s editor formats the same way, a changed line in a manifest is a changed value — not someone’s editor reflowing the file around it — so a diff of two versions shows only what somebody meant to change.
What is a YAML validator?
A YAML validator reads a file and reports what is wrong with it before something downstream tries to use it. That timing is the whole value.
A broken Kubernetes manifest fails at kubectl apply. A broken workflow fails after you push. A broken Compose file fails when the stack comes up — sometimes in front of people. Every one of those loops is minutes long, and every one of them is avoidable by checking the syntax locally first.
Two findings here are worth more than the rest, because nothing else reports them:
Duplicate keys. Most parsers keep the last one and say nothing. The earlier value is discarded silently — which is how a config file stops doing what it visibly says.
An alias with no anchor. The file parses. It then throws the moment anything reads the data, so it passes a naive syntax check and fails at deploy time.
What this does not do is check a schema. It will tell you a Kubernetes manifest is valid YAML; it will not tell you that replicas was spelled replica. That needs kubectl --dry-run=server, and the two checks are complementary rather than alternatives.
How YAML formatting works
The file is parsed into a tree that keeps not only the data but where every comment sat and how every scalar was written. The tree is then written back out with consistent indentation.
Keeping the comments is the hard part, and the reason most YAML libraries cannot format: a parser that produces plain JavaScript objects has already thrown them away. Preserving them needs the parse to retain the syntax as well as the meaning.
Some things are deliberately never touched, because rewriting them would change what the file says:
Block scalars. Inside a | literal block every line break is content. Re-indenting a multi-line script in a CI file changes the script.
Anchors and aliases.An alias is expanded into duplicated content by naive formatters, turning a small file into a large one and losing the author’s intent. They stay as references.
Quoting that carries meaning."1.10" is a string and 1.10 is the number 1.1. Removing those quotes would silently change a version number.
The guarantee is tested rather than asserted: for every sample and every combination of options, the tool parses the input and the output and compares the data. If formatting ever changed a value, a type, or the order of a list, that test fails.
How YAML validation works
Indentation rules
Indentation is YAML’s only way of expressing nesting. Every key in the same mapping needs the same indentation, and a nested block needs more than its parent. Tabs are forbidden outright — a tab has no defined width, so the same file would nest differently in different editors.
Mapping and sequence validation
A mapping entry needs a key, a colon, and a space after the colon. A sequence item needs a dash and a space. Both are checked, along with the case that catches people out: a key and its colon must be on the same line, so a missing colon shows up as “a key spans more than one line” on the line after the mistake.
Anchors and aliases
An anchor &name labels a node; an alias *name refers back to it; a merge key <<: *name folds one mapping into another. All three are resolved. An alias with no matching anchor is reported as an error, which most parsers do not do.
Multi-document validation
A single file can hold several documents separated by ---, which is how a Kubernetes manifest ships a Deployment, a Service and a ConfigMap together. Each is parsed and validated independently, and every finding says which document it came from.
Tags
!Ref and !GetAtt are not YAML — they are CloudFormation intrinsics written as YAML tags. A generic parser reports them as unresolved, on every line, in a template that is perfectly correct. This tool recognises the CloudFormation and Ansible tag sets and names them instead, because a validator that lights up a working file teaches people to ignore it.
Supported YAML features
Mappings and sequences, nested to any depth, in both block and flow style.
Anchors and aliases, kept as references rather than expanded.
Merge keys.<<: *defaults is resolved — without it, the key is read as one literally named << and the merged values are simply absent.
Literal blocks (|) keep every line break. This is how multi-line shell scripts live inside a pipeline.
Folded blocks (>) join their lines with spaces — for long prose that should read as one paragraph.
All scalar types: strings, integers, floats, booleans, null, dates, and every quoting style.
Multiple documents separated by ---, with ... end markers.
Comments, preserved with their placement.
YAML vs JSON
They describe the same shapes. YAML is in fact a superset of JSON — any JSON file is already valid YAML, which you can check by pasting one into this tool. The differences are about who is writing.
Aspect
YAML
JSON
Readability
Indentation, no brackets — reads like an outline
Braces and quotes everywhere
Comments
Yes, with #
None. The single biggest reason config moved to YAML
File size
Smaller — no braces, quotes optional
Larger, but compresses well
Ambiguity
Implicit typing surprises: NO, 1.10, yes
One way to write everything
Reuse
Anchors, aliases and merge keys
None — repeat yourself
Parsing
Complex; implementations differ
Trivial and identical everywhere
Written by
People — config, pipelines, manifests
Programs — APIs, data interchange
The rule that follows from the last row: YAML for what people write, JSON for what programs write. Configuration, pipelines and manifests are edited by hand and benefit from comments. API payloads and data interchange are produced by code, where YAML’s flexibility is a liability rather than a feature — and the JSON formatter is the better place to read one.
Common YAML use cases
Almost every one of these fails slowly — after a push, after an apply, after a deploy — which is what makes checking locally worth the few seconds.
Kubernetes
Manifests are where most people meet YAML, and where a misplaced two spaces means a Deployment silently has no resource limits. Multi-document files with several resources are handled as one.
Docker Compose
Compose leans on anchors and merge keys to share service definitions. Both are resolved here, so what you see is what Compose will read.
GitHub Actions
Workflows fail at push time rather than at edit time, which makes a local validator worth a lot. The classic bug — an unquoted on: becoming the boolean true — is in the sample library.
GitLab CI
Pipelines use YAML's extension features harder than almost anything else: anchors, merge keys and deeply nested job definitions.
CircleCI and Azure Pipelines
Both use multi-line scripts inside literal blocks, where the block indentation is part of the command. Formatting leaves those untouched.
Helm charts
A values file is the interface to a chart, and its empty mappings and empty strings are meaningful defaults rather than clutter. They survive formatting exactly.
Ansible
Playbooks are top-level sequences rather than mappings, which trips up tools that assume a document starts with a key. Handled here, along with Ansible's own tags.
CloudFormation
Templates are full of !Ref, !GetAtt and !Sub — intrinsic functions written as YAML tags. This tool names them as CloudFormation rather than reporting every line as an unresolved tag.
Application configuration
The everyday case: a config file with nested sections, comments explaining the awkward settings, and values that must stay strings even though they look like numbers.
Common YAML validation errors
Tabs instead of spaces
The most common YAML error there is, and the least obvious, because a tab looks like spaces. YAML forbids tabs in indentation entirely. Set your editor to insert spaces for .yaml files and the problem never recurs.
Bad indentation
The value belongs to nothing
1spec:2 replicas: 33 selector: # one space too many4 app: api
Every key at the same level needs the same indentation. A single extra space makes a key part of a different block — sometimes legally, which is worse, because the file parses and means something else.
Missing colon
The error usually points at the line after the mistake, reported as a key spanning more than one line: the parser is still looking for the colon it never found.
Duplicate keys
1env:2 LOG_LEVEL: debug3 LOG_LEVEL: info # the first one is silently discarded
Invalid lists
A sequence item needs a dash and a space. -itemis the string “-item”, not a list entry — and it parses cleanly, so nothing complains until the value turns out to be the wrong shape.
Implicit typing
None of these are what they look like
1country: NO # false, under YAML 1.1 rules — the "Norway problem"2version: 1.10 # the number 1.1 — the trailing zero is gone3enabled: yes # boolean true, not the string "yes"4port: 08 # an invalid octal number
Quote anything that is meant to be a string, and every one of these disappears.
YAML best practices
Use spaces, never tabs. Configure your editor once, per file type, and stop thinking about it.
Two spaces per level, consistently. YAML nests deeply and four runs out of line quickly. What matters more than the number is that it never changes within a file.
Quote anything that must stay a string. Versions, country codes, ports, booleans-as-text, anything with a leading zero. This is the single highest-value habit in YAML.
Validate before deploying. Locally, in a pre-commit hook, and in CI. A syntax error found in an editor costs seconds; the same error found by a pipeline costs minutes and a broken build.
Comment the surprising, not the obvious.# replicas above replicas: helps nobody. # 3 minimum for the rolling update to work is the reason someone will need in six months.
Use anchors for genuine reuse, sparingly. They remove duplication, and a file with a dozen of them is harder to read than the repetition would have been.
Keep files small and split by concern. Multi-document files are supported everywhere; one enormous manifest is harder to review than five focused ones.
Never commit secrets. YAML config sits in version control by definition. Use a secret store and reference it.
Frequently asked questions
Is this YAML Formatter free?
Yes. Formatting, validation, minifying, the sample library, search, statistics, copy and download are all free, with no account and no limit on file size.
Is this also a YAML Validator?
Yes — it is both, and validation runs continuously rather than on a button. Every keystroke re-checks the document, so a broken manifest tells you which line and column before you have finished typing it.
Is my YAML uploaded?
No. Parsing, formatting and validation all happen in your browser — nothing is sent over the network, stored or logged. You can disconnect after the page loads and keep working. That matters here more than most: YAML files carry cluster names, image registries, environment variables and occasionally secrets that should never have been committed.
Does formatting change my YAML data?
No, and it is tested rather than promised. For every sample and every combination of options, the tool parses the input and the output and compares the resulting data — if formatting ever changed a value, a type or the order of a list, that test fails. Formatting changes whitespace, quoting and key order; it never changes what the file means.
Can I validate Kubernetes YAML?
Yes, including multi-document manifests where several resources are separated by ---. The validator checks YAML syntax — indentation, mappings, sequences, anchors, duplicate keys — which is where the overwhelming majority of manifest errors are. It does not check the Kubernetes schema, so it will not tell you that a field name is wrong for a Deployment; use kubectl --dry-run=server for that.
Can I validate Docker Compose files?
Yes. Compose files lean heavily on anchors and merge keys for shared service definitions, and both are supported — a << merge is resolved rather than treated as a key literally named '<<', which is what happens in parsers that leave it off.
Can I validate GitHub Actions workflows?
Yes, and the sample includes the trap that catches everyone: the `on:` key. Under YAML 1.1 rules an unquoted `on` is the boolean true, so the key becomes `true:` and the workflow never triggers. Quote it as "on" and the problem goes away.
Does this support multi-document YAML?
Yes. Documents separated by --- are parsed, validated and formatted individually, and each diagnostic says which document it came from. The end-of-document marker ... is handled too. A single document is written without a leading separator; several always keep theirs, because --- is the only thing making them separate.
Can I fix YAML indentation?
Formatting rewrites the indentation consistently at two or four spaces, which fixes files that have drifted between styles. What it cannot do is guess what you meant when the indentation is ambiguous — if a line is indented in a way that changes which block it belongs to, that is a different document rather than a badly formatted one, and the validator says so instead.
Why are tabs not allowed in YAML?
Because a tab has no defined width, and YAML uses indentation to express structure. If a tab could mean indentation, the same file would nest differently depending on the editor that opened it. So the specification forbids tabs in indentation outright — and since most editors insert them silently, it is the single most common YAML error. A tab inside a value is fine; only indentation is affected.
What causes YAML validation errors?
In rough order of frequency: tabs used for indentation, indentation that does not line up with its siblings, a missing colon after a key, a duplicate key in the same mapping, an unterminated quote, and an alias pointing at an anchor that was never defined. Every one of those is reported here with a line, a column and what to change.
Does it support YAML anchors and aliases?
Yes, including merge keys. Anchors (&name) and aliases (*name) survive formatting intact rather than being expanded into duplicated content, which matters because expanding them would change a small file into a large one and lose the author's intent. The validator also catches an alias with no matching anchor — something most parsers accept silently and then throw on when the document is read.
Can I format Helm values files?
Yes. Helm values are ordinary YAML, and the empty mappings and empty strings they use for defaults — nodeSelector: {} and tag: "" — are preserved exactly. A formatter that rewrote {} as nothing would change the chart's behaviour.
Can I upload YAML files?
Yes, .yaml and .yml up to 10 MB, by the upload button or by dropping a file anywhere on the tool. The file is read locally and never leaves your machine.
Can it handle large YAML files?
Yes. Anything above about 60 KB is processed in a Web Worker so the editor never stutters while you type, and a megabyte of manifests formats and validates in well under a second. Deeply nested documents are handled too.
What does minifying YAML do?
YAML has no equivalent of JSON's whitespace stripping — its indentation is its structure. What it does have is flow style, which is where its JSON compatibility shows: { a: 1, b: [2, 3] } is valid YAML and valid JSON and means exactly what the indented form meant. Minifying drops comments and rewrites collections in flow style. The saving is real but smaller than JSON's.
Should I use YAML or JSON?
YAML for anything a human writes and maintains — configuration, pipelines, manifests — because it has comments, needs no brackets, and reads as an outline. JSON for anything a program produces and consumes, because it has one obvious way to write everything and no implicit typing to surprise you. YAML is a superset of JSON, so any JSON file is already valid YAML.
Why did my unquoted value change type?
YAML infers types from how a value looks. Unquoted, NO becomes false in YAML 1.1 parsers (the Norway problem), 1.10 becomes the number 1.1 and loses its trailing zero, 08 can be an invalid octal, and yes, on and off all become booleans. Quote anything that is meant to be a string and the problem disappears — the environment-variables sample demonstrates each case.
Are comments preserved when formatting?
Yes, including where they sit — a comment above a key stays above it and a trailing comment stays on its line. This is harder than it sounds and most YAML libraries cannot do it, because it needs the parser to keep a concrete syntax tree rather than just the data. Comments are the main reason people choose YAML, so losing them would defeat the point.
Does this tool work offline?
Once the page has loaded, yes. Parsing, formatting and validation are all local, so it keeps working with the network disconnected.
Keep going
Tools that pair with this one
Same privacy model — everything below runs in your browser too.