.env ↔ JSON / YAML Converter


Converting .env Files to JSON & YAML

Environment files (.env) are the standard way to store local development settings, database URLs, and API keys for Node.js, PHP/Laravel/Yii, Python, and Docker Compose. However, cloud deployment platforms - such as Kubernetes ConfigMaps/Secrets, GitHub Actions workflows, AWS ECS task definitions, and Terraform - frequently require those same key-value pairs in YAML or JSON format. This tool converts seamlessly between .env, JSON, and YAML directly in your browser.

Parsing Rules & Edge Cases

  • Comments & Blank Lines: Lines starting with # and empty lines are safely skipped when parsing .env into JSON or YAML.
  • Quoted Values: Surrounding single ('...') or double ("...") quotes around values - such as APP_NAME="My App" or DB_PASS='p@ss=123' - are automatically stripped so you do not end up with literal extra quotes in JSON/YAML.
  • Equals Signs Inside Values: Splitting only on the first = preserves Base64 keys, connection strings, and query parameters containing =.
  • export Prefixes: Shell-style export KEY=VALUE lines are handled cleanly.

Security & DevOps FAQ

  • Is it safe to paste production .env secrets here? Yes. All conversion runs 100% locally in your browser's JavaScript memory - nothing is logged, stored, or transmitted over the network.
  • How do I use the YAML output in Kubernetes or Docker Compose? Paste the generated YAML under data: or stringData: in a Kubernetes Secret/ConfigMap, or under environment: in docker-compose.yml.
  • Can I convert JSON back to .env? Yes - switch the target mode to convert a flat JSON object back into KEY=VALUE lines, automatically quoting values that contain spaces or # characters.
Please read the privacy policy (agreement of the cookies usage, other websites embedded content, etc.). If you continue to use the site, we will assume that you agree with our privacy policy.
OkPrivacy Policy