Minify YAML safely

Turn a block document into compact flow style. Values, tags and anchors are kept; the comments that cannot survive are counted before you apply.

Default. true/false/null/ints/floats resolve per YAML 1.2.2 core; yes/no/on/off and dates stay strings.

Source

14 lines · rev 1

Paste or type YAML. Drop a file here to open it. Your source changes only when you apply a result.

Checking…Re-checking the latest source…

Preparing preview…

Download
Not editedNo preview yet.

What minifying changes

Block mappings and sequences become { } and [ ]; literal and folded block scalars become double-quoted strings with escaped newlines; blank lines are removed. Anchors, aliases and explicit tags remain, so shared nodes stay shared.

Comments have no place in a one-line document, so they are removed and reported as a consent-required loss. Keep the original if you need them.

Minified YAML or JSON?

Minified YAML keeps YAML-only features — anchors, tags, timestamps, non-string keys — that JSON cannot represent. If a consumer needs JSON, use the YAML to JSON converter, which lists each loss.

Questions

Is minified YAML still valid YAML?
Yes. The output is re-parsed and compared to the source before it can be applied; if it does not parse or a value differs, the result is blocked.
Are multi-document files supported?
Yes. Each document is minified separately and the --- separators remain.

Other tools