
Paste YAML or open a file. The compressed version shows up here as you type, checked against your original.
Runs entirely in your browser. Your YAML is never uploaded.
This YAML compressor shrinks .yaml and .yml files by removing comments and blank lines, tightening indentation, or turning the whole file into a single line, without changing the data inside. Paste a file or open one and the result updates as you type. Every result is read back and compared with your original under both YAML 1.2 and YAML 1.1 rules, so you know it means exactly the same thing before you download it. It also works as a quick YAML validator: if the file has a mistake, you’ll see the line and column.
How to compress a YAML file
- Paste your YAML into the left box, use Open file, or drag the file onto the box.
- Pick a Style. Keep layout only removes comments and blank lines. Compact also shrinks indentation. One line gives the smallest file.
- Check the Changes tab to see which lines were removed or edited, and the Check tab to confirm the data is unchanged.
- Copy the result, download the smaller
.yaml, or download a.gzcopy.
The three styles
| Style | What it does | Best for |
|---|---|---|
| Keep layout | Removes comments, blank lines and trailing spaces. Everything else stays exactly as you wrote it, down to the character. | Config files people still read and edit, like Docker Compose, GitHub Actions and Kubernetes manifests |
| Compact | Also re-indents with 1 space and lines list items up with their parent key | Smaller files that are still block-style YAML |
| One line | Writes each document on a single line in flow style, using { } for mappings and [ ] for lists. Comments are always removed. | The smallest file for storing, embedding or sending YAML |
Before and after
# Web service
services:
web:
image: nginx:1.27 # pinned version
ports:
- "8080:80"
environment:
DEBUG: "no"Keep layout gives:
services:
web:
image: nginx:1.27
ports:
- "8080:80"
environment:
DEBUG: "no"One line gives:
{services: {web: {image: "nginx:1.27", ports: ["8080:80"], environment: {DEBUG: "no"}}}}Why your data stays the same
YAML is easy to break by accident, because the same text can mean different things to different parsers. In YAML 1.1, used by PyYAML, Ruby and older Go libraries, an unquoted no is the boolean false and 0777 is the number 511. In YAML 1.2, used by most newer parsers, they’re the text “no” and the number 777. A compressor that rewrites "no" as no, or 0777 as 777, quietly changes your data for some of the programs that read it.
This tool keeps the exact spelling of every number, word and quoted value. It then reads both your original and the result with YAML 1.2 rules and again with YAML 1.1 rules, and compares every key and value. If anything differs, download is turned off and you’ll see why. It was tested on more than 3,400 real YAML files and the full official YAML test suite.
What’s never changed
- Keys, values and the order they appear in
- Quoted strings, including their quote style
- Multi-line text in
|and>blocks, including the line breaks and spacing inside them - Anchors, aliases and merge keys (
&base,*base,<<) - Tags like
!!stror!Ref, and the---between multiple documents - Line endings. Files with Windows CRLF line endings keep them.
Should you use the GZIP download?
GZIP usually makes a YAML file 50–65% smaller, and even smaller after minifying. That’s great for backups, storage and sending files over slow connections. But tools like kubectl, Docker Compose and GitHub Actions can’t read a .gz file directly. Unzip it first (gunzip config.yaml.gz on Linux and macOS, or 7-Zip on Windows). If you need a smaller file an app can load, use the regular .yaml download.
Frequently asked questions
Will this break my Kubernetes, Docker Compose or GitHub Actions file?
Not with Keep layout, which only removes comments and blank lines. Compact and One line are valid YAML too, and the tool checks they hold the same data, but they’re harder for people to read. For files your team edits, stick with Keep layout.
Why not just convert YAML to JSON?
JSON can’t keep anchors, aliases, tags or non-text keys, and some YAML 1.1 parsers have trouble with JSON-style syntax. One line flow style is about as small, and it keeps everything.
How much smaller will my file get?
It depends on how many comments and how much indentation the file has. Across more than 3,400 real files, heavily commented configs shrank by 35–50% with Keep layout. Files without comments gain little from Keep layout, but deeply nested ones still shrink with Compact and One line, which cut the total size of all those files by about a quarter.
Why is download turned off?
Either the YAML has a syntax error, which is shown with its line and column, or the chosen style couldn’t rewrite the file without changing its data. That can happen with unusual structures like complex keys. Keep layout works for every valid file.
Can I get my comments back?
No, removed comments are gone from the compressed file. Keep your original as the editable copy and use the compressed one for deploying, storing or sending.
Is my YAML uploaded anywhere?
No. Everything runs in your browser, including the check and the GZIP step. YAML files often contain passwords, tokens and server addresses, and none of it leaves your device. Only your option choices are remembered in your browser.
