About the YAML Formatter
YAML uses indentation for structure, so inconsistent spacing makes files hard to review and easy to break. This formatter runs Prettier's YAML printer, which re-indents nested mappings and sequences to a consistent width, normalizes spacing after : and -, and tidies flow collections — [ main, dev ] becomes [main, dev] and {a: 1} becomes { a: 1 }. Comments, document separators (---), anchors, aliases and block scalars (| and >) are preserved.
Quoted strings are printed with double quotes by default or single quotes when Single quotes is ticked; Prettier keeps whichever quote needs fewer escapes. It never reorders keys, changes values or converts types, so a Kubernetes manifest or Ansible playbook means the same after formatting. Tabs are not offered because the YAML specification forbids tab characters for indentation.
If the document does not parse — for example a key indented one space too far or a tab used for indentation — you get the error with its line and column. Syntax validity is all it checks; it does not validate against a Kubernetes or GitHub Actions schema. The file is processed locally in your browser.
How to use it
- Paste YAML or open a .yml / .yaml file.
- Choose 2 or 4 spaces and the print width.
- Tick Single quotes if your style prefers them.
- Copy or download the formatted YAML.
Frequently asked questions
Can YAML use tabs for indentation?
Does the formatter keep my comments?
Will it convert yes/no or on/off values?
yes, no, on and off as booleans; quote them if you mean strings.