Format YAML

Prettify YAML with consistent indentation, quoting, and line breaks.

freeworks offlinenothing uploaded
ToolYAML Formatter
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

The input is parsed into YAML values and serialized with consistent indentation, quoting, and line breaks. Presentation changes while mappings, sequences, scalars, and dates remain represented by the serializer.

  • Two spaces match common configuration style.
  • Parser-based formatting respects indentation structure.

Worked example

Expand inline flow-style to block
Convert compact inline YAML objects to properly indented block style
Input
											server:
  host: localhost
  port: 3000
database: {url: 'postgres://localhost/db', pool: 5}
										
Output
												server:
  host: localhost
  port: 3000
database:
  url: postgres://localhost/db
  pool: 5

											

When to use this

Kubernetes, Docker Compose, and static-site data files format YAML.

Edge cases

  • Bare values such as yes can be typed differently by YAML versions.
  • Multiline scalar folding is data-sensitive.
  • Comments may be dropped because the serializer writes values.

References