# ENV / Shell / Docker Converter

> Free online .env converter. Convert dotenv files to JSON, YAML, TOML, shell export, and Docker ENV instantly in your browser. No upload, 100% private.

- **Category:** Developer
- **URL:** https://www.teafun.cyou/tools/env-converter/
- **Privacy:** Runs entirely in your browser — no uploads, no account, no tracking.
- **Also known as:** .env, dotenv, docker env, shell env, environment variables
- **Related tools:** [Structured Data Converter](https://www.teafun.cyou/tools/yaml-json-toml/), [JSON Formatter & Validator](https://www.teafun.cyou/tools/json-formatter/), [JWT Decoder](https://www.teafun.cyou/tools/jwt-decoder/)
- **Tags:** Data, Conversion

## About

Convert .env files to JSON, YAML, TOML, shell export, and Docker ENV instantly in your browser. Nothing is uploaded — all conversion is client-side.

## 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.

_SEO title: ENV Converter – Format Config Files Online | TeaFun_

## FAQ

### 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.
