YAML Minifier
Minify and compress YAML by removing whitespace
YAML Input
Minified Output
Paste your YAML on the left and the result shows up here.
Or drop a file on this box, , or .
What is YAML Minifier?
Need a YAML file on one line, or just smaller? The YAML Minifier rewrites your YAML (YAML Ain't Markup Language) in flow style: {subscribers: [{subscriberId: SUB-1001, plan: Unlimited 5G}]}. All indentation and line breaks between keys disappear. It's the same idea as minification for JavaScript or CSS: smaller text, same data.
Flow style is part of the YAML specification, so any YAML parser reads the output and gets the same keys and values back. Big integers keep every digit and unquoted dates like 2024-01-15 stay as written. Files with several --- documents keep them, one flow line each. What you lose: comments, blank lines, and anchors (aliases are expanded into copies).
Everything happens in your browser, so your YAML never leaves your computer. The savings pill above the output shows the real byte difference for your file.
How to Use the YAML Minifier
Paste, check the savings, copy.
Paste, Upload, or Load Sample
Put the YAML in the left pane. Uploading works too, but a file that does not parse is turned away with a message rather than loaded. Sample brings in a commented subscriber file; this backup-job block makes a smaller test:
# nightly backup job
job:
name: pg-nightly-dump
schedule: "0 3 * * *"
retainDays: 14
targets:
- orders-db
- ledger-db View Minified Output
The right panel shows the minified YAML, one flow-style line per document, and the pill above it shows how many bytes that saved. Invalid YAML shows the parser error instead.
Download or Copy
For the backup job the right pane holds {job: {name: pg-nightly-dump, schedule: 0 3 * * *, retainDays: 14, targets: [orders-db, ledger-db]}}, and the pill reports 33 bytes saved (24.8%), since the comment and every indent are gone. Download writes it as minified.yaml, Copy puts it on the clipboard, and Clear resets both panes and the pill.
When You'd Actually Use This
Production Deployment
Collapse a config onto one line so it fits inside an env var, a command-line flag or a --set-json-style argument: places where quoting multi-line YAML is miserable.
API Optimization
Paste a short YAML snippet into a chat message, ticket or log line without the indentation getting mangled on the way.
Storage Efficiency
Compare two YAML files structurally: minify both and the differences show up on one line each, without indentation noise.
Network Transfer
Shrink YAML test fixtures or seed data checked into a repo when nobody reads them by hand. For anything humans edit, keep the readable version.
Common Questions
Is my YAML data stored?
No. The document is parsed and written back out inside the page, and nothing is posted anywhere while you work. Reload the tab and the input is gone.
Does minification break my YAML?
No. Flow style is standard YAML, so keys, values and nesting come back the same when you parse it. Comments are removed, and anchors and aliases are expanded into full copies, so a file that leans heavily on <<: *defaults can actually get longer.
How much smaller does it get?
It depends on how deeply the file is indented and how many comments it has. The sample saves about 15%. Deeply nested Kubernetes or Compose files with comments save more; a file that's already in flow style saves nothing. The pill shows the exact number for your input.
Can I format it back?
Yes. Paste the output into the YAML Formatter to get indented block style back. Comments removed during minification don't come back, so keep your original if they matter.
What about multi-line strings?
Their content is kept exactly, but they're rewritten as quoted strings with \n escapes, because block scalars (| and >) can't live on one line.
Does it work with large files?
A few MB minifies in well under a second. The whole file is parsed in your browser's memory, so for very large files a command-line tool like yq is the better fit.
Other YAML Tools You Might Need
Flow style suits a single environment variable or a test fixture, less so a human reader. When you need the readable version back, or want the same data as JSON or CSV, these pages pick it up: