Skip to content
devutils.info

DevOps Tools · Guide

YAML Formatter / Validator guide

Validate and re-format YAML with clear parser errors and safe parsing.

Open the YAML Formatter / Validator

About the YAML Formatter / Validator

YAML is the configuration language of Kubernetes, Docker Compose, GitHub Actions, Ansible and OpenAPI. Its reliance on indentation means one misplaced space can change meaning or break a deployment.

This tool validates YAML, reports parser errors with line and column, and re-formats documents with consistent indentation while preserving comments, key order, anchors and value types.

How to use

  1. Paste YAML into the editor or load the sample.
  2. Choose 2- or 4-space indentation.
  3. Click Format (or Validate to check without reformatting).
  4. Fix any reported errors, then copy the result.

Examples

Normalise indentation

Input

services:
    web:
         image: nginx
         ports:
         - "80:80"

Output

services:
  web:
    image: nginx
    ports:
      - "80:80"

Common error: tab indentation

Input

key:
	value: 1

Output

Tabs are not allowed as indentation

Parser behavior

  • Parses YAML 1.2 using the core schema with the open-source yaml library.
  • yes/no/on/off are strings in YAML 1.2 (they were booleans in YAML 1.1). Quote values when in doubt.
  • Multi-document streams separated by --- are supported.
  • Duplicate keys are reported as errors.
  • Safe parsing: custom tags such as !!python/object are never constructed — unknown tags produce a warning and the value is treated as plain data. Alias expansion is limited to prevent “billion laughs” attacks.

Frequently asked questions

Does formatting change my data?

No. The document is round-tripped through its syntax tree, so values, types, comments and key order are preserved; only indentation and spacing are normalised. Long strings are not re-wrapped.

Why does my file fail with a tab error?

YAML forbids tab characters for indentation. Replace tabs with spaces.

Can I convert YAML to JSON?

Use the JSON/YAML Tree Visualizer to inspect structure, or paste data into the JSON Formatter once converted.

Ready to try it? Everything runs locally in your browser.

Open the tool