What are .env and YAML?
A .env file holds environment variables as KEY=value lines, one per line; frameworks and Docker load it into the process environment at startup. YAML describes the same data as JSON with indentation instead of brackets, allows comments and is the language of most configuration files.
Common when moving variables from a .env into a Kubernetes manifest, a Docker Compose environment: block or a GitHub Actions workflow.
This page opens the data converter already set to .env → YAML. Paste the text, read the result as you type, then copy it or download it as a file. Errors show the line and the column. Nothing is sent anywhere: the conversion runs in your browser.
.env vs YAML
| .env | YAML | |
|---|---|---|
| Extension | .env | .yaml, .yml |
| Media type | none (plain text) | application/yaml |
| Comments | yes (#) | yes (#) |
| Data types | text only | JSON types plus dates, anchors and aliases |
| Nesting | none: flat keys | any depth, by indentation |
| Typical use | secrets and settings of apps, Docker, CI | Kubernetes, Docker Compose, CI pipelines |
| Specification | convention (no formal spec) | YAML 1.2.2 |
When to convert .env to YAML
- Convert to YAML when people will read and edit the file by hand.
- Keep .env when the values go into environment variables of an app or a container.
What changes in the conversion
- Comments of the .env file are not carried over: the converter reads the data, and comments are not data.
- Every value is text (a
.envhas no numbers or booleans), quotes are removed,exportprefixes are accepted and keys keep their exact spelling.
How to convert .env to YAML
- Paste your .env in the input box (the page opens with an example you can replace).
- Read the YAML on the right; it updates as you type. If something is wrong, the message says the line and column.
- Adjust the options if you need: indentation, sorted keys or type detection.
- Copy the result or download it as a
.yamlfile.
Example
This .env input:
# orders service
APP_NAME=orders
APP_PORT=8080
DATABASE_URL=postgres://db:5432/orders
DATABASE_POOL=10
GREETING="Olá, mundo"becomes this YAML, exactly as the converter writes it:
APP_NAME: orders
APP_PORT: "8080"
DATABASE_URL: postgres://db:5432/orders
DATABASE_POOL: "10"
GREETING: Olá, mundo
Frequently asked questions
Is my .env sent to a server?
No. Conversion happens in your browser, so secrets in a config never leave your computer.
Does .env to YAML keep comments?
No. Comments are dropped because the converter works on the data itself. Copy important comments by hand.
What happens to nested data?
.env nesting: none: flat keys. YAML nesting: any depth, by indentation. The structure is kept as it is.