What this .env converter does
Configuration moves between formats all the time: a local .env file becomes a Kubernetes Secret, a JSON config becomes environment variables in CI, a YAML file feeds a Helm chart. This converter reads environment variables from .env, JSON, YAML, Kubernetes Secret or ConfigMap manifests, docker env-files or shell export lines, and writes them to any of those formats. A second mode compares two env files and lists variables that are missing, extra, empty or duplicated, which is exactly what you need before a deploy fails because someone forgot to add a key to production.
How to use it
- In Convert mode, paste your variables and choose the input format, or leave it on auto-detect.
- Choose the output format. For Kubernetes, set the resource name; Secret values are Base64-encoded automatically.
- Copy or download the result.
- In Compare mode, paste your real
.envinto A and.env.exampleor another environment into B. - Review the lists: missing in A, extra in A, empty values and duplicate keys.
Format details
- .env: supports comments,
exportprefixes, single and double quotes, escaped newlines in double quotes and inline comments after unquoted values. - JSON / YAML: a flat object of keys to values. Nested objects are flattened with
__(e.g.DB__HOST) and numbers or booleans become strings. - Kubernetes Secret: uses
datawith Base64 values; incoming manifests withstringDataare also understood. - ConfigMap: plain string values under
data. - docker env-file:
KEY=valuewith no quote processing, exactly asdocker run --env-filereads it. - Shell:
export KEY='value'lines with safe single-quote escaping, ready tosource.
Tips
- Base64 is encoding, not encryption. Anyone who can read a Kubernetes Secret manifest can read its values; use Sealed Secrets, SOPS or an external secret manager for git.
- Keep
.env.examplein version control with empty values and use the compare mode in code review. - Keys are case-sensitive on Linux;
Api_KeyandAPI_KEYare different variables.