inyourbrowser.com

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

How to format YAML

  1. Paste your YAML document into the input pane.
  2. Choose an action: Format, Validate, YAML to JSON, or JSON to YAML.
  3. Pick the indentation width: 2 or 4 spaces.
  4. 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 the JSON_SCHEMA safe schema (blocks unsafe tags such as !!js/function). Output re-emitted by dump() with the chosen indentation. Conversion mode round-trips through JSON.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 JSON for 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.

Reviewed and tested September 30, 2026.