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 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 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.
  • Browser API or library: js-yaml (YAML 1.2 parser). 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 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.