ENV / Shell / Docker Converter
Convert .env files to JSON, YAML, TOML, shell export, and Docker ENV instantly in your browser. Nothing is uploaded — all conversion is client-side.
Converter
0 / 500,000 bytes
You just tested your ENV / Shell / Docker Converter — Try Structured Data Converter next →
What Is an ENV Converter?
There is no formal dotenv specification — the .env format started as Heroku-Foreman convention and forked into incompatible dialects. The python-dotenv parser accepts key=value, key = value (with whitespace), single-quoted and double-quoted values, and \n escape sequences inside double quotes. The Node dotenv package historically did not honour escapes (SECRET="line1\nline2" reads as literal backslash-n, not newline). Go's godotenv and Rust's dotenvy each have their own quirks. The converter normalises across six common formats: dotenv (KEY=value), JSON ({"KEY":"value"}), YAML (KEY: value), TOML (KEY = "value"), shell export (export KEY=value), and Docker ENV (ENV KEY=value). Multiline values use "..." with explicit \n in dotenv, the | literal block in YAML, triple quotes in TOML, and continuation via backslash in shell. The converter preserves them across all six. Comments (# in dotenv / YAML / TOML / shell, // is not part of the dotenv spec despite some parsers accepting it) are stripped on conversion to JSON since JSON forbids comments per RFC 8259.
How to Use the ENV Converter
Pick From and To formats. Paste your env file. The output appears live in the right panel. Use the swap button to reverse direction — useful for sanity-checking that a .env file converted to JSON and back is identical. Multiline values: write MULTILINE="line1\nline2" in dotenv; the converter expands the \n correctly for YAML's | literal block when converting that direction. Quoted values: dotenv accepts both KEY="value" and KEY='value' and strips the outer quotes. Special characters: $ inside double quotes triggers variable substitution in some parsers — the converter does not substitute, treating values as literal strings. The error pane lists the line where parsing failed: KEY="unclosed will be flagged at the line containing the unterminated quote. Copy or download with the appropriate file extension.
Why Consistent Environment Variables Matter
Docker has three different ways to set environment variables: ENV KEY=value in the Dockerfile (baked into the image at build time, available at runtime), ARG KEY in the Dockerfile (build-time only, not present at runtime unless explicitly promoted to ENV), and docker run -e KEY=value / docker compose environment: (set at container start, override ENV). Confusing these is a classic incident pattern — a secret baked into the image via ENV is visible in docker history and accidentally pushed to a public registry, whereas the same secret passed via -e at runtime stays off the image layers. Converting a .env file for local dev into docker-compose.yml environment block, or into Kubernetes ConfigMap YAML, requires understanding which mechanism your target stage uses. The converter's role is purely syntactic — semantics (build-time vs runtime, secret vs config) is on you.
Frequently Asked Questions
Is my data safe?
Yes. All conversion happens entirely in your browser using JavaScript. Nothing is sent to any server. You can even use this tool offline.
Does it support multiline values?
Yes, quoted multiline values in .env files are supported. For example: CERT="line1\nline2".
What happens with comments?
Comments (lines starting with #) are stripped during conversion. They are not preserved in the output format.
Use this tool inside a bigger workflow
These collections group follow-up tools and guides that commonly belong in the same job.
Browse same tags
Jump to other tools that share the same workflow, format, or use case.