YAML Formatter and Viewer
Format, validate, and visualize YAML documents with tree view and customizable indentation.
YAML Formatter and Viewer tool
Example
Input: server: / host: example.com / ports: [80, 443] (nested with 6-space indents)
Result: server: / host: example.com / ports: / - 80 / - 443 (each level indented 2 spaces)
The YAML is parsed and re-written with consistent 2-space indentation, single spaces after colons and flow lists expanded to block lists.
- Paste your YAML document into the input text area.
- Choose an indent size (2 or 4 spaces) to match your project conventions.
- Click "Format YAML" - any syntax error, such as tab characters or inconsistent indentation, is reported with its line and column.
- View the reformatted YAML with clean, consistent indentation in the output area.
- Click "Show Tree View" to interactively expand and collapse nested nodes for easier navigation.
- Click the copy button to copy the formatted YAML to your clipboard.
Formatting YAML and Finding Indentation Errors
A YAML formatter rewrites a YAML file with consistent indentation and spacing, so its structure is easy to see. This one also validates the syntax, points to the line and column of any error, and can show the data as a collapsible tree.
YAML uses indentation instead of brackets to show structure. A key that is two spaces too far right quietly becomes the child of the wrong parent, and tabs are not allowed for indentation at all. Pasting a Kubernetes manifest or a GitHub Actions workflow here catches those mistakes before a deploy does. Duplicate keys and unclosed quotes or brackets are reported too.
Click Format YAML to parse the document and write it back with 2 or 4 spaces per level. Extra spaces after colons are removed and inline lists like [80, 443] are expanded into - items. Files with several documents separated by --- are supported, and each is formatted in turn. The YAML 1.2 core schema is used, so dates like 2024-01-01 stay as written instead of turning into timestamps.
Because the file is parsed and rewritten, some details are not kept. Comments are removed, and anchors and aliases are expanded into full copies of the data. Keep your original if those matter. Show Tree View displays the parsed data with the top two levels open and an item count on each branch. To use the result in code, convert it with YAML to JSON.
Sources
Frequently Asked Questions
Related Tools
JSON to YAML Converter
Convert JSON documents to YAML format with syntax validation, clean formatting, and instant preview.
Developer ToolsYAML to JSON Converter
Parse YAML documents and convert to formatted JSON with error reporting and syntax validation.
Developer ToolsYAML to TOML Converter
Transform YAML documents to TOML configuration format with proper table structure and types.
Developer ToolsJSON Formatter and Validator
Format, validate, beautify, and minify JSON data with a collapsible tree view and line-and-column error detection.
Developer Tools