Compact YAML documents into flow style

Compact YAML with flow-style collections while preserving parsed values.

freeworks offlinenothing uploaded
ToolYAML Minify
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 YAML document is parsed and serialized with flow collections where configured, reducing block indentation and line breaks. Comments and original formatting are not retained as data.

  • Flow style keeps compact snippets embeddable.
  • Parsing first protects indentation-sensitive structure.

Worked example

Compact a user list config
Convert block-style YAML with nested arrays to compact flow style. Reduces size by ~19%
Input
											users:
  - name: Alice
    email: [email protected]
    roles:
      - admin
      - editor
  - name: Bob
    email: [email protected]
    roles:
      - viewer
										
Output
												{users: [{name: Alice, email: [email protected], roles: [admin, editor]}, {name: Bob, email: [email protected], roles: [viewer]}]}
											

When to use this

Environment values, build artifacts, and compact configuration snapshots use flow YAML.

Edge cases

  • Multiline scalars can remain multiline because their content is data.
  • Comments disappear during serialization.
  • Invalid indentation fails rather than being compacted heuristically.

References