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. Supports multi-document YAML, anchors, and nested structures. Free, runs in your browser.
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 files with consistent indentation
- Converting a YAML config to JSON, then pretty-printing or minifying the JSON for a JSON-only tool
- Validating GitHub Actions or other CI pipeline files before pushing a change
- Formatting two versions of an OpenAPI document and comparing them line by line
Technical specification
- Algorithm or formula: Input parsed by js-yaml's
loadAll()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; YAML to JSON also resolves YAML merge keys (<<). - Browser API or library: js-yaml (YAML 1.2 parser), running in a Web Worker that starts with the page; a job that runs longer than 5 seconds is stopped. 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 supported: Format re-emits every document separated by---, and YAML to JSON returns an array when there is more than one document. Results far larger than the input (for example from repeated aliases) are refused with an error. - 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. Numbers are parsed as 64-bit floating point: integers beyond 2^53 may be rounded (a note appears when the document contains one) and number literals are normalised (1.0 to 1, hex and octal to decimal).
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.
Related tools
XML formatter
Pretty-print, minify, and validate XML. Uses the browser's native DOMParser.
JSON formatter
Pretty-print, minify, validate, and sort JSON keys. Instant output.
SQL formatter
Beautify and format SQL queries. Supports MySQL, PostgreSQL, T-SQL and standard SQL.
CSV ↔ JSON
Convert CSV to JSON and JSON back to CSV. Handles quoted fields and downloads.
- Background reading: Complete guide to developer tools
Reviewed and tested September 30, 2026.