YAML Formatter

Free online YAML formatter and validator. Paste YAML to re-indent and validate it in your browser.

Suggested tools

JSON to YAML

Convert JSON into readable YAML.

JSONYAML
Open Tool

YAML to JSON

Convert YAML into JSON.

YAMLJSON
Open Tool

XML to YAML

Convert XML into YAML.

XMLYAML
Open Tool

YAML to XML

Convert YAML into XML.

YAMLXML
Open Tool

YAML to CSV

Convert a YAML list into CSV.

YAMLCSV
Open Tool

CSV to YAML

Convert CSV into YAML.

CSVYAML
Open Tool

About YAML Formatter

YAML Formatter re-indents YAML with consistent two-space indentation and checks it for syntax errors at the same time. Use it to tidy Docker Compose files, Kubernetes manifests, GitHub Actions workflows, Ansible playbooks and other config before committing them.

Anchors, aliases and merge keys (<<) are understood, and errors show the line where the YAML breaks — usually a tab, an inconsistent indent or a missing space after a colon. Everything runs locally in your browser — the text you paste is never uploaded.

How to use YAML Formatter

  1. Paste YAML, upload a .yaml/.yml file or click Sample.
  2. Press Beautify to re-indent, or Validate to check it.
  3. Copy or download the formatted YAML.

Key features

  • Consistent two-space indentation
  • Syntax check with line numbers
  • Anchors, aliases and merge keys supported
  • YAML 1.2 rules — yes/no/on/off stay text

Example

Inconsistent indentation and a flow list, normalised.

Input
server:
    port: 8080
    host:   localhost
features: [login, upload]
Output
server:
  port: 8080
  host: localhost
features:
  - login
  - upload

When to use YAML Formatter

  • Tidying YAML edited by several people with different indentation habits.
  • Normalising config files before committing them.
  • Checking YAML for errors while formatting it.

Tips and common problems

  • Beautify removes comments; use Validate if you only want to check a commented file.
  • Flow lists like [a, b] are written as block lists, one item per line.
  • Anchors are expanded into their full values.

Frequently asked questions

No. Beautify rebuilds the YAML from its data, and comments are not data. Use Validate if you only want to check a commented file.