API Tools

YAML Formatter & Beautifier

Free online YAML Formatter, Validator, and Minifier. Format, beautify, and inspect YAML 1.2 documents with indentation control, multi-document support, and a live structure tree — all in your browser.

Load Interactive YAML Samples:
YAML Specification & Formatting Options Formatting Options
AST dump strips comments; best-effort mode keeps # lines.
Serializer may still quote when required for validity.
Drop YAML file here
Supports UTF-8, .yaml, .yml, .txt
Raw YAML Input Raw YAML
Formatted YAML Output Formatted
Ctrl + Enter to format instantly
Validation Result
Syntax check complete.
YAML 1.2
YAML Document Metrics & Structure Analysis
Characters0
Lines0
File Size0 B
Documents0
Keys0
Mappings0
Sequences0
Scalars0
Strings0
Numbers0
Booleans0
Nulls0
Anchors0
Aliases0
Tags0
Max Depth0
Validation—
YAML Structure Viewer
Tree structure preview will appear here after parsing...

How to Format YAML Online

YAML (YAML Ain’t Markup Language) is a human-friendly data serialization format used for configuration files, CI pipelines, Kubernetes manifests, Docker Compose, and API specs. This formatter parses your document with js-yaml (YAML 1.2 by default), then rewrites it with consistent indentation and spacing without sending data to a server.

How to use this YAML Formatter

  1. Paste YAML into the left editor, upload a .yaml / .yml file, or load a sample.
  2. Choose indentation (2–8 spaces), schema, and optional advanced settings.
  3. Click Format / Beautify, Validate, or Minify.
  4. Review diagnostics, statistics, and the structure viewer; then copy or download the result.

YAML indentation & data types

YAML hierarchy is defined by spaces (never tabs). Scalars include strings, integers, floats, booleans, and nulls. Collections are mappings (objects) and sequences (arrays). Multiple documents can appear in one file separated by ---.

Mappings

Key/value pairs using key: value. Nested maps increase indentation by your chosen space count.

Sequences

Lists use - item in block style or [a, b] in flow style. Order is always preserved.

Anchors

Reuse nodes with &name and *name. Parsing expands aliases into the data model for inspection.

Example: raw vs formatted

name:John
age:25
skills:
 -PHP
 -Laravel
name: John
age: 25
skills:
  - PHP
  - Laravel

Frequently Asked Questions

A YAML Formatter beautifies and validates YAML documents by parsing them with a standards-aware parser and rewriting them with consistent indentation, spacing, and structure. This PaceTools YAML Formatter formats, minifies (compact representation), validates syntax, shows document statistics, and renders an interactive structure tree — entirely in your browser.

YAML 1.2 is the default and primary target, implemented via the js-yaml library (JSON Schema / CORE Schema resolution). The tool can optionally parse with the YAML 1.1-compatible FAILSAFE schema for stricter string preservation of scalars that look like booleans or numbers.

Full AST round-trips with js-yaml do not retain comments. When "Preserve comments (best effort)" is enabled, the tool uses a cosmetic indentation/spacing beautifier that keeps # comment lines intact without re-serializing through the AST. Disable that option for the strongest structural rewrite via parse and dump.

Structural formatting (parse → dump) preserves parsed values and types according to the selected schema. Presentation may change (quoting style, flow vs block). Key order is preserved by default; alphabetical sorting is optional and off by default. Sequence order is never reordered.

Minify removes unnecessary blank lines and prefers compact flow style where the serializer can emit it safely, then re-parses the result to verify it is still valid YAML with equivalent structure. If a compact form cannot be produced safely, the tool explains the limitation instead of emitting invalid YAML.

No. Parsing, formatting, validation, statistics, search, and the structure viewer run 100% client-side in your browser. Nothing is sent to PaceTools servers for processing.