YAML Minifier — Minify, Beautify & Validate YAML Online
Free online YAML minifier and beautifier. Compress YAML into compact single-line flow style, pretty-print it with your own indent and quoting style, validate syntax with exact line/column errors, and see byte-level size savings — all 100% in your browser, nothing uploaded.
| / > blocks, comments, anchors, aliases, merge keys). Multi-document streams, explicit tags (!foo), complex keys, and tab indentation are rejected with a precise line/column error instead of being guessed.How to minify YAML
- Paste your YAML into the input box (or upload a
.yaml/.ymlfile). - Keep Minify mode to compress everything into single-line flow style, or switch to Beautify to reprint clean block YAML.
- Tune quoting style, indent size, or enable key sorting if you need it.
- Copy the result or download it — the stats bar shows exactly how many bytes you saved.
Frequently asked questions
What does a YAML minifier do?
A YAML minifier rewrites a YAML document into compact flow style on a single line — mappings become {key: value} and sequences become [item1, item2] — removing indentation, blank lines, and comments. For example, a 214-byte commented config minifies to 151 bytes here (63 bytes saved, 29.4% smaller). The data is unchanged; only the layout is compressed.
Is minified YAML still valid YAML?
Yes. Flow style ({...} and [...]) is part of the YAML 1.2 specification, so the single-line output parses with any compliant YAML parser — PyYAML, js-yaml, Go yaml, Kubernetes, and CI systems. Minifying changes whitespace and layout, never keys, values, or structure.
What happens to anchors, aliases, and merge keys when I minify?
This tool resolves them: aliases (*ref) are inlined at each use and merge keys (<<: *base) are expanded into the mapping. That means a shared anchor used three times appears three times in the output — the result stays valid and self-contained, but files heavy on anchors may shrink less. This behavior is disclosed because silently keeping or dropping references could change your data.
Is my YAML uploaded to a server?
No. The parser, minifier, and beautifier all run locally in your browser with zero network requests — your YAML never leaves the page. You can verify this in your browser developer tools: this page makes no fetch or XHR calls.
Which YAML features are supported?
The built-in parser (no external libraries) supports block mappings and sequences, nested indentation, inline flow collections, single- and double-quoted scalars, literal (|) and folded (>) blocks, comments, anchors, aliases, and merge keys. It rejects what it cannot safely handle with a line/column error: multi-document streams, explicit tags, complex mapping keys, and tab indentation.
What is the difference between minify and beautify mode?
Minify compresses everything into single-line flow style for the smallest size. Beautify does the opposite: it reprints the document in clean block style with your chosen indent (2 or 4 spaces) and quoting style (minimal, single, or double quotes) — ideal for readable diffs and config reviews.
How much smaller will my YAML get?
It depends on comments, blank lines, and nesting depth. The sample config on this page goes from 214 bytes to 151 bytes — 63 bytes (29.4%) saved, mostly from stripped comments and indentation. Deeply nested CI and Kubernetes manifests with comments typically shrink 15–40%. The live statistics panel shows your exact savings.
Free tool by NRTechStudio