YAML Formatter & Re-indenter

Normalise YAML indentation and spacing in your browser — no upload.

Ad placeholder (leaderboard)
Enjoying the tools? Go Pro for £4.99 (one-time) and remove all ads — forever, on this device. Remove ads — £4.99

YAML formatter and re-indenter

Paste YAML with inconsistent indentation, stray tabs or untidy spacing and get back a normalised document. This is the quick fix for config files — Docker Compose, Kubernetes manifests, GitHub Actions workflows, Ansible playbooks — that have drifted into mixed two- and four-space indents or picked up a tab that breaks the parser.

How it works

The formatter is a dependency-free re-indenter, not a full parser, which keeps it fast and lossless. It works in three steps:

  1. Expand tabs to spaces — YAML disallows tabs for indentation, so every tab becomes two spaces.
  2. Detect and normalise depth — it measures the leading-space depth of each line, finds the smallest positive gap between distinct depths as your source step, then snaps every nesting level onto your chosen 2- or 4-space unit.
  3. Tidy spacing — it collapses runs of spaces after the first key: colon and after a list - .

Lines inside a | or > block scalar are detected by being more indented than their key and are copied verbatim, so embedded scripts and text keep their exact layout. Keys, values and block contents are never changed — only whitespace.

Example

Messy input (note the mixed spacing and over-indented dashes):

name:    Gera Tools
tools:
  -   xml
  -   yaml
meta:
    runs: browser

Formatted with a 2-space indent:

name: Gera Tools
tools:
  - xml
  - yaml
meta:
  runs: browser
Indent optionCommon use
2 spacesDefault for Compose, Kubernetes, CI YAML
4 spacesTeams preferring wider visual nesting

Everything runs in your browser as plain JavaScript, so your YAML — and any secrets in it — never leaves your device.

Ad placeholder (rectangle)