YAML formatter
YAML formatter is a developer tool that formats, validates, and converts YAML documents. It uses the js-yaml parser in safe mode, handles Kubernetes manifests and OpenAPI specs, and converts to or from JSON with configurable indentation. The tool runs in your browser.
Input YAML
Formatted YAML
ACTION
INDENT
Runs entirely in your browser
Dedicated pages
Direct links for specific YAML workflows.
Format YAML Online
Format and pretty-print YAML files online with consistent indentation. Works with Kubernetes, OpenAPI, and CI configs. All processing runs in your browser.
YAML to JSON Converter
Convert YAML documents to JSON in your browser. Supports multi-document YAML, anchors, and nested structures. Free and runs entirely client-side.
YAML Validator
Check YAML syntax instantly. Get clear error messages with line numbers for any parsing issue. All validation runs in your browser.
How to format YAML
- Paste your YAML document into the input pane.
- Choose an action: Format, Validate, YAML to JSON, or JSON to YAML.
- Pick the indentation width: 2 or 4 spaces.
- Copy the result from the output pane.
Common uses
- Reformatting Kubernetes manifests and Helm values with consistent indentation
- Converting YAML configs to JSON for use with JSON formatter or other JSON-only tools
- Validating CI pipeline files before pushing a change
- Normalising OpenAPI documents for review or version control
Technical specification
- Algorithm or formula: Input parsed by js-yaml's
load()with theJSON_SCHEMAsafe schema (blocks unsafe tags such as!!js/function). Output re-emitted bydump()with the chosen indentation. Conversion mode round-trips throughJSON.parse/JSON.stringify. - Browser API or library: js-yaml (YAML 1.2 parser). Native
JSONfor YAML-to-JSON and JSON-to-YAML round-trips. - Input limits: No hard cap; tested with documents up to 5 MB. Multi-document YAML (separated by
---) is parsed but only the first document is re-emitted in single-doc mode. - Output: Formatted YAML, validated YAML, JSON, or YAML at indentation widths 2 or 4. Errors include line and column.
- Known limitations: Safe-schema mode rejects custom tags. Comments are not preserved across format and convert operations because the parser does not retain them.
Frequently asked questions
- Can this tool convert between YAML and JSON?
- Yes, in both directions. Choose YAML to JSON to flatten a YAML document into JSON, or JSON to YAML to reformat structured data. Standard YAML 1.2 documents are supported including Kubernetes manifests, Helm chart values, GitHub Actions workflows, and OpenAPI specifications. All conversion runs in your browser using the js-yaml library.
- Is my YAML sent to a server?
- All processing runs in your browser using the js-yaml library bundled with the page. Our servers are not involved at any point.
- Does the formatter work with Kubernetes manifests?
- Yes. The parser understands standard YAML 1.2 documents including Kubernetes manifests, Helm chart values, GitHub Actions workflows, and OpenAPI specifications.
- What is the difference between formatting and converting?
- Formatting normalises indentation and quoting while keeping YAML output. Converting transforms YAML into JSON or JSON into YAML so the same data can be used by different tools.
- Can I validate YAML without changing the output?
- Yes. Choose the Validate action and the tool reports whether the document parses successfully, with line numbers for any error encountered.
- Will indentation switches break my anchors or aliases?
- Anchors and aliases are resolved during parsing and re-emitted in the chosen indentation. The resulting document represents the same data structure.
Reviewed and tested May 26, 2026.