How to use it
- Paste the YAML or open a .yaml or .yml file.
- Leave Language on YAML and the action on Format (preselected here).
- Fix any error at the line and column shown, and pick 2 or 4 spaces.
- Copy the result or download formatted.yaml.
Worked example
server: with port: 8080 # main and hosts: [a, b] indented by four spaces, followed by name: app, becomes server: with port: 8080 # main and hosts: [a, b] indented by two spaces, then name: app.
Formats and limits
| Input | YAML |
|---|---|
| Output | Formatted YAML |
| Engine | js-yaml (YAML 1.2) and fast-xml-parser with validator |
Limitations
- Formatting checks YAML syntax, not a schema such as Kubernetes or Docker Compose rules.
- Tabs are not offered for YAML indentation, because YAML forbids them.
- Long strings are not re-wrapped.
Questions
Are comments and key order kept?
Yes. Prettier's YAML printer keeps comments, key order and flow lists such as [a, b]; it changes indentation and spacing.
Why does it say tab characters must not be used?
YAML does not allow tabs for indentation. The error gives the line and column; replace the tabs with spaces and the file formats.
Does it handle several documents in one file?
Yes. Documents separated by --- are formatted together, and the summary says how many were found.
Is my YAML uploaded?
No. The text is processed in your browser and nothing is uploaded.
Privacy
Runs on your device. Files and text are processed in this browser tab and are not uploaded.
This page opens the YAML and XML formatter and validator ready for this task. See the privacy policy for how toolsdocks handles data.