YAML Formatter & Validator
Format YAML with consistent indentation and validate common YAML syntax and structure errors.
On this page
Free YAML Formatter and Validator
This free YAML Formatter and Validator turns messy or compact YAML into clean, consistently indented markup and checks it for syntax problems in your browser. It parses locally, reports the exact line and column for errors such as bad indentation, missing colons, unclosed brackets, duplicate keys, tabs, and unknown aliases, and shows a formatted result alongside a tree view and file statistics.
Paste YAML, load a file, or start with an example
Paste YAML into the input editor, choose a local .yaml or .yml file to load it, or drag a file onto the file row. Files are read locally and are not uploaded. Use the Example menu to load a ready-made sample for Kubernetes, Docker Compose, GitHub Actions, or Anchors and aliases. The status bar shows line and column at the caret together with total lines and characters, and the gutter updates as you type. Clear resets the input, output, and status without reloading the page.
Format YAML with the indentation and sort you need
Format parses the current input, resolves anchors, aliases, and merge keys (<<: *defaults) into their final values, and prints each document with consistent indentation. Choose 2 spaces, 4 spaces, or one tab from the Indent control. Turn on Sort keys to output mapping keys in A to Z order, which is useful for comparing files or producing a canonical form. Comments and the original anchor and alias syntax are not preserved in the formatted YAML because the output represents the resolved data. For multi-document files separated by ---, each document is formatted and joined with --- separators.
Check YAML syntax and find the problem
Validate checks the input with a local YAML parser that enforces indentation, mapping structure, flow collections, quoting, block scalars, document separators, and alias resolution. It reports problems such as tabs in indentation, unexpected indentation, missing : after a mapping key, unclosed { or [, duplicate keys, missing anchor names, unknown aliases, unterminated quoted strings, missing block scalar content, and nesting deeper than 200 levels. When a position is available the message includes line and column so you can locate the error quickly. The status indicator turns green for valid YAML and red for invalid input, and the alert area describes the first error found.
Minify, convert to JSON, copy, or download the result
Minify produces a compact flow style using inline {} and [] for mappings and sequences while keeping the same data. To JSON converts the parsed YAML documents to JSON, pretty printed with 2-space indentation, and switches the output to JSON mode so Copy and Download use converted.json. Copy places the current output on the clipboard with a legacy textarea fallback when the Clipboard API is unavailable, and Download saves it as formatted.yaml or converted.json depending on the last action. The output panel reports its own line and character counts and shows the detected type of the first document. Output is capped at 500,000 input characters to keep the browser responsive. For example, name: Ada stays name: Ada after Format, {a: 1, b: 2} expands to block style with two-space indentation, and a two-document file with --- converts to a JSON array with two objects.
Inspect the document as a tree and review statistics
After a successful parse open the Tree tab to explore the document hierarchy with expandable mappings and sequences. Each level shows its key or index, empty mappings and sequences are marked, and scalar values are displayed as text. Expand all and Collapse all affect the whole tree, and the view is limited to 2,500 nodes. Open the Stats tab to review counts for documents, keys, sequence items, scalars, maximum depth, anchors, aliases, merge keys, block scalars (| and >), and comment lines.
Search, focus, and mobile editing
Find text searches the input or the formatted output and selects the next match, reporting the line where it was found. Ctrl+F or Command+F focuses the search field for the active panel, and Enter finds the next match while Escape closes the search. The editor includes line numbers, caret position, font size controls A- and A+, and full screen buttons for the input and output cards. On smaller screens the input, actions, and output stack vertically so controls remain usable without horizontal page scrolling.
Private browser processing
The YAML stays in your browser while you work. This tool does not send the input to a server, fetch a URL, or run external schema validation. It checks YAML 1.2-like structure including block and flow collections, quoted and plain scalars, block literals and folded scalars, anchors and aliases, merge keys, and multi-document streams, which covers the structure most configuration files rely on. Complex custom tags and explicit directives are treated as plain values.