Loading YAML Minifier...
Please wait a moment

How to Minify YAML Files - Step by Step Guide

Step 1

Input Your YAML File

Ready to compress your YAML files for Kubernetes deployments, Docker containers, or CI/CD pipelines? Paste your YAML content with comments, extra spacing, and verbose formatting. If the file has a mistake, the output panel tells you the line and column. You can also validate your YAML first, or format it again later for editing.

Example: commented YAML (290 characters)

Here's a typical YAML file with lots of comments and spacing:

# Application Configuration File
# This file contains all the settings

# Server Configuration
server:
  # The hostname to bind to
  host: "localhost"
  
  # The port number
  port: 8080
  
  # Enable SSL/TLS
  ssl: true

# Database Configuration
database:
  host: "db.example.com"
  port: 5432
Step 2

See Automatic Minification

Comments and blank lines go, and everything under a top-level key is folded onto one line in flow style. Values are not touched, and the result is checked against your input before it appears. Handy for bandwidth optimization.

Minified result (93 characters, about 68% smaller)

This is exactly what the page produces for the Step 1 example:

server: {host: localhost, port: 8080, ssl: true}
database: {host: db.example.com, port: 5432}
Step 3

Copy or Download Compressed YAML

Copy the minified YAML or download it as minified.yaml. It is still ordinary YAML, so Kubernetes, Docker Compose and CI tools read it the same way as the original.

•
Smaller files: comments, blank lines and indentation are gone
•
Faster loading: Improved network transfer speeds
•
Lower bandwidth: Reduced hosting and CDN costs
•
Production ready: Clean files without development comments
•
Same data: the result is read back and compared with your input before it is shown

Frequently Asked Questions

What does the YAML minifier actually remove?

Comments, blank lines and the indentation that nested blocks need. Top-level keys stay one per line, and everything under them is rewritten in YAML's compact flow style, so a server block with host and port underneath becomes server: {host: localhost, port: 8080}.

Will my values change?

No. Numbers, dates and strings are written back exactly as you typed them, so 00501, 14.50, 0x1F, 2024-01-15 and long IDs like 8901240544102066246 come out unchanged. Shared anchors stay as references (renamed to &ref_0, &ref_1 and so on, and << merge keys are written out in full), and files with several --- documents stay separate. Before showing the result, the page reads it back and compares it with your input; if anything differs, you get an error instead of a changed file. The one thing you do lose is your comments.

How much smaller will my YAML file become?

It depends on the file. Heavily commented, deeply indented configs often shrink by half or more. A short file with no comments may barely change, because the keys and values themselves are still there. The badge above the output shows the real figure for your file.

Can I turn minified YAML back into something readable?

Yes, run it through the YAML Formatter and it goes back to normal block style with indentation. Comments can't be recovered, so keep your original file if you need them.

Is my YAML uploaded anywhere?

No. Minifying happens in your browser and nothing is sent to our server. Very large files can take a few seconds because the work runs on your own device.