← All tools/Minifiers/Code/YAML Formatter
YAML Formatter
Paste YAML below and this formatter fixes the indentation, checks the syntax, and shows the first error with its exact line and column — nothing is uploaded.
Formatted YAML
name: shop items: - id: 1 - id: 2
Valid YAML
How it works
key: value — a mapping (the space after the colon is optional) key: — a nested block follows, indented - item — a list item - key: value — a list of mappings Errors are reported with the exact line and column. This formatter handles the common YAML 1.2 subset: mappings, lists, nested blocks and plain or quoted scalars.
The sample “name:shop” (no space after the colon) formats to “name: shop”, and the list items gain the chosen indent: “items:” followed by “ - id: 1” and “ - id: 2” with 2-space indent.
Parses the YAML 1.2 subset used by most config files: mappings, sequences, nesting, plain and quoted scalars. Last updated November 2026.
Frequently asked questions
Is my YAML sent anywhere?
No. The formatting runs entirely in your browser — nothing is uploaded, so you can safely format private configs and secrets.
Why did it flag my file as invalid?
The error names the exact line and column. The usual causes are a tab used for indentation, a missing colon after a key, or mixed indentation depths in the same block.
Does it accept “key:value” with no space after the colon?
Yes. This formatter is lenient about the space after the colon, so “name:shop” formats to “name: shop”.
Which YAML features are not supported?
Block scalars (| and >), multi-line quoted strings, anchors, aliases and tags are outside this subset and are reported as errors. Mappings, lists, nesting and plain or quoted values all work.
Should I use 2 or 4 spaces?
Two spaces is the usual YAML convention and the default here. Four spaces is fine too — pick one and use it everywhere in the file.
Tell us what you think
Loving this tool, or stuck on something? Tell us — it takes a minute.
We’ll only use your name and email to reply if needed. The tool and page are filled in for you.