YAML Formatter
Reformat YAML in your browser: normalize indentation to 2 spaces and consistent flow style. Validates while formatting. Free and private.
About this tool
Normalize any YAML document to consistent 2-space indentation and block style. Handy for cleaning up hand-edited manifests where indentation has drifted, or for canonicalizing YAML before a diff.
The document is fully parsed and re-serialized, so formatting doubles as validation: structural errors are reported with their location. Note that comments are removed, because the parser's data model does not preserve them.
Common uses
- Normalize a Kubernetes manifest before code review.
- Canonicalize two YAML files so a diff shows real changes only.
- Validate and clean YAML in one step.
Automate via API
The same conversion is available as a REST endpoint for scripts, pipelines, and backends:
curl -X POST https://payloadly.com/api/v1/tools/yaml-formatter \ -H "Content-Type: text/plain" \ -H "X-Api-Key: YOUR_API_KEY" \ --data-binary @input.yaml
YAML notes
YAML is a human-friendly superset of JSON used heavily in Kubernetes manifests, GitHub Actions workflows, Docker Compose files, and CI/CD pipelines. Indentation is structural, and unquoted scalars are type-coerced.
- Indentation defines structure; tabs are not allowed for indentation.
- Unquoted values like `no`, `on`, or `1.0` may be coerced to booleans or numbers.
- Comments (`# ...`) cannot survive a round-trip through JSON.
Frequently asked questions
Is my data uploaded to a server?
No. This tool runs entirely in your browser using JavaScript, and there are no ads on the page. Nothing you paste or drop here is uploaded, logged, or stored, and you can verify that yourself: open your browser's developer tools and watch the Network tab while you convert (no requests leave the page), or disconnect from the internet after the page loads and keep working.
Are my YAML comments preserved?
No. Reformatting parses the document into data and re-serializes it, and comments are not part of the data model. If you need comment-preserving formatting, use an editor-integrated formatter instead.
Is there a size limit or a fee?
The browser tool is free with no signup and comfortably handles files up to tens of megabytes (limited by your device's memory). For automated or bulk processing inside your own scripts and pipelines, use the paid REST API.
Related tools
Convert YAML to JSON instantly in your browser. Validates syntax with line numbers, outputs pretty-printed JSON. Free and fully client-side.
Convert YAML to TOML directly in your browser. Move configs between ecosystems without hand-rewriting. Free, client-side, no upload.
Validate YAML syntax in your browser with line-numbered errors. Catches indentation and structure problems before your CI does. Free.
Convert JSON to clean, readable YAML in your browser. Ideal for Kubernetes, Docker Compose, and CI config. Free, no signup, nothing uploaded.