ENV to YAML Converter — Free Online
.env to YAML Converter
Paste a .env file and get the same settings as nested YAML — handy when moving configuration into Docker Compose, Kubernetes, Helm values or an application config file. Conversion runs in your browser; your secrets are never uploaded.
How the conversion works
- Each
KEY=valueline becomes an entry. Blank lines and lines starting with#are skipped, and inline comments (URL=http://x # note) are stripped. export KEY=valueis accepted — theexportprefix is removed.- Quoted values may span several lines. Single quotes are literal; double quotes understand
\n,\t,\"and\\. - Numbered keys become lists:
APP_SERVERS_0andAPP_SERVERS_1give aserverslist, so YAML to .env and back round-trips. - Nothing is silently lost. If a name is both a value and a prefix (
APP=1andAPP_NAME=x),app_nameis kept as a flat key, and lines without=are reported as# warning:comments at the top of the YAML. The Options bar sets nesting, key case and type inference. - Underscores become nesting and keys are lowercased:
APP_NAMEandAPP_PORTbecomenameandportunderapp. - Surrounding quotes are removed.
- Values stay strings.
.envfiles have no types, so8080is written as'8080'. Remove the quotes in the YAML if your consumer needs a number.
Example
# comment
APP_NAME=demo
APP_PORT=8080
DB_URL="postgres://u:p@h/db"
export DEBUG=truebecomes
app:
name: demo
port: '8080'
db:
url: postgres://u:p@h/db
debug: 'true'When nesting is not what you want
Splitting on _ suits names such as DB_HOST and DB_PORT, which share a prefix. A name like MAX_UPLOAD_SIZE turns into three levels (max.upload.size). If you need flat keys — for a Kubernetes env: list or a ConfigMap — keep the variable names as they are and build the list by hand, or edit the nested output.
Handle secrets carefully
.env files often hold passwords and API keys. Conversion happens locally, but the YAML you produce is just as sensitive: keep it out of version control, and use your platform's secret store (Kubernetes Secrets, Docker secrets, a vault) instead of plain config.
Related tools
- YAML to .env — the reverse direction
- .env to JSON
- YAML Validator