.env · transform🔒 100% client-side — never leaves your browser

ENV to YAML Converter

Convert .env to YAML online: this ENV to YAML converter turns a dotenv file into a plain YAML map, a docker-compose environment: block, a GitHub Actions env: block or an Ansible vars file, with quoting that keeps every value exactly as it was.

By Aliniyaz Mamat · last reviewed

Be the first to rate
DATABASE_URL: postgres://user:pass@localhost:5432/app
PORT: 3000
DEBUG: true
APP_NAME: "My App"

Key takeaways

  • ✓Values YAML would misread are quoted: yes, no, on, off (booleans in YAML 1.1 / Ansible) and 3.10 (would become 3.1).
  • ✓With coerce types on, 3000, true and null become real YAML numbers, booleans and null; non-canonical numbers like 0123 or 3.10 stay strings.
  • ✓docker-compose output is always quoted with $ doubled, because Compose rejects unquoted booleans and interpolates $.
  • ✓Tested: every output parses back to the original values with both a YAML 1.1 parser (as used by Ansible) and a YAML 1.2 parser.
  • ✓Comments from the .env are not carried over; add them to the YAML afterwards.

What it does

  • ▸Plain YAML map, docker-compose, GitHub Actions env: and Ansible vars
  • ▸YAML 1.1-safe quoting (yes/no/on/off, versions, special characters)
  • ▸Optional type coercion for numbers, booleans and null
  • ▸$ escaping for docker-compose
  • ▸Copy or download, 100% client-side

Privacy

Runs 100% in your browser. Your .env never touches our servers.

client-side only

Usage examples

Case 1 · Plain YAML, coerce on
PORT=3000
DEBUG=true
PYTHON_VERSION=3.10
FEATURE_X=yes
PORT: 3000
DEBUG: true
PYTHON_VERSION: "3.10"
FEATURE_X: "yes"
Case 2 · GitHub Actions env
NODE_ENV=test
API_URL=https://api.example.com
jobs:
  app:
    runs-on: ubuntu-latest
    env:
      NODE_ENV: test
      API_URL: https://api.example.com
Case 3 · docker-compose
DEBUG=true
DB_PASS=pa$word
services:
  app:
    environment:
      DEBUG: "true"
      DB_PASS: "pa$$word"

When to use this tool

  • →Moving settings from a .env into a Helm values.yaml or a Kubernetes ConfigMap
  • →Writing the env: block of a GitHub Actions workflow
  • →Turning a .env into Ansible group_vars
  • →Converting a local .env into a docker-compose environment: section

Common mistakes

  • ⚠Copying secrets into a workflow file or values.yaml that is committed. Use GitHub Actions secrets (${{ secrets.X }}) or a Secret instead
  • ⚠Editing the YAML by hand and dropping the quotes: COUNTRY: NO becomes false in Ansible
  • ⚠Turning on coercion for IDs or version strings your app expects as text
  • ⚠Expecting ${VAR} references in .env values to be resolved. They are copied as literal text

Why .env to YAML needs careful quoting

A .env value is always a string. YAML guesses types from unquoted text, and the guesses differ between YAML 1.1 (PyYAML, Ansible, older Kubernetes tooling) and YAML 1.2:

.env valueUnquoted YAML 1.1 readsUnquoted YAML 1.2 readsConverter writes
yes / no / on / offbooleanstring"yes" (quoted)
3.10number 3.1number 3.1"3.10"
0123octal 83number 123"0123"
a: ba nested mapa nested map"a: b"
*staran alias (error)an alias (error)"*star"
3000 (coerce on)numbernumber3000

The famous case is the "Norway problem": a list of country codes where NO silently became false. Quoting anything ambiguous avoids that class of bug entirely.

Using the output

Kubernetes ConfigMap

apiVersion: v1
kind: ConfigMap
metadata:
  name: app-config
data:          # ConfigMap data values must be strings: turn coerce OFF
  NODE_ENV: production
  PORT: "3000"

GitHub Actions with secrets

env:
  NODE_ENV: test                                # plain values from the converter
  DATABASE_URL: ${{ secrets.DATABASE_URL }}     # secrets stay in GitHub

The guide GitHub Actions secrets covers repository vs environment secrets and how to write a .env file inside a job. For Compose, the ENV to Docker converter also produces Dockerfile ENV lines and Kubernetes Secrets.

Converting back: YAML to .env

# flat YAML map -> .env (mikefarah/yq v4)
yq -o=props '.' config.yaml | sed 's/ = /=/' > .env

# or via JSON
yq -o=json '.' config.yaml > config.json   # then use the JSON to ENV converter

Nested YAML has to be flattened first; the JSON to ENV converter does that automatically with _ separators.

Frequently asked questions

Which output formats are supported?

A plain YAML map, a docker-compose environment: block, a GitHub Actions job env: block and an Ansible vars file starting with ---.

Are special characters handled?

Yes. Values with :, #, quotes, leading *, &, !, spaces at the ends, or words YAML reads as booleans are written as double-quoted strings with proper escaping.

Are comments from the .env converted?

No. Only keys and values are converted. YAML comments use the same # syntax, so you can paste section comments back in.

Is the output safe for a GitHub Actions workflow?

Syntactically, yes. Content-wise, only for non-secret values: workflow files are committed, so secrets belong in repository or environment secrets.

Is my .env uploaded?

No. The conversion runs in your browser.

Related tools

Learn more

Compare

coming soon

Get notified when env syncing launches

We're building a tiny tool to keep .env files in sync across teammates and environments. Leave your email — no spam, just a single launch ping.

We use your address only for this launch email. You can ask us to delete it at any time. Privacy policy