YAML Formatter
Format and validate YAML in your browser. Fix indentation, catch syntax errors, and keep config files on your device.
Paste or type, or drop a file on the box.
Runs in your browser. Nothing you enter is uploaded or stored.
How to use the YAML Formatter
- Paste or type your YAML into the input box, or load the sample to try it.
- The cleaned-up result appears as you type. Pick 2 or 4 spaces for the indent.
- If the YAML is not valid, read the message under the boxes for the line and column of the problem.
- Switch the output to Tree to close and open any list or mapping, which makes a long file easier to explore.
- Copy the result or download it as a .yaml file.
Questions and answers
- Can I collapse lists and mappings?
- Yes. Switch the output from Text to Tree, then click the arrow beside a list or mapping to close or open it. A closed one shows how many items or keys it holds. The tree shows the data only: comments are left out, and an alias is shown as the value it points to. Copy and Download always give you the complete YAML with comments, whatever is closed.
- Is my YAML sent to a server?
- No. Parsing and formatting run entirely in your browser. Nothing you paste is uploaded, stored or logged, so it is safe to use with Kubernetes manifests, CI pipelines and other config files that hold private values.
- Are my comments kept?
- Yes. Comments stay attached to the lines they belong to, and blank lines between sections are kept as well. Only the indentation and spacing are made consistent.
- Why is my YAML reported as invalid?
- Most errors come from indentation: a tab used instead of spaces, or items in the same list or mapping that do not line up. Other common causes are a missing space after a colon, a quote that is never closed, a value that contains ": " without being quoted, and the same key used twice in one mapping.
- Why can I not indent with tabs?
- The YAML specification does not allow tab characters for indentation, so every YAML tool uses spaces. Two spaces is the most common choice; four is also widely used.
- Does formatting change my data?
- No. Keys keep their order, and strings, numbers, anchors, aliases and block text keep their values. What changes is layout: indentation is made even, extra spaces are removed, and long lines are left unfolded.
- Can I format a file with several documents?
- Yes. Documents separated by --- are each validated and formatted, and the separators are kept in the output.
Related tools
JSON FormatterFormat, validate and minify JSON in your browser. Clear error messages, free, and nothing you paste is uploaded.XML FormatterFormat and validate XML in your browser. Indent messy markup, spot syntax errors, and keep your data on your device.Base64 Encode and DecodeEncode text to Base64 or decode it back in your browser, with full UTF-8 support. Free, instant and nothing is uploaded.File to Base64Convert an image or any file to a Base64 string or data URI, and turn Base64 back into a file. Runs in your browser.URL Encode and DecodePercent-encode text for use in a URL or decode an encoded URL back to readable text. Free and runs in your browser.