.env ↔ JSON / YAML Converter

Your data never leaves your browser

Convert .env files to JSON or YAML and back. Handles comments, quotes, export prefixes, and nested keys. Runs entirely in your browser.

Input — .env
Output — JSON
Ctrl+Shift+CCopyCtrl+KClear

Share this tool

Found it useful? Help a fellow developer discover it.

https://developertoolkit.dev/tools/env-converter

Moving config between .env, JSON, and YAML

Every modern deployment environment has a different config format. Local development uses .env files loaded by dotenv. Docker Compose reads them directly. Kubernetes expects secrets as JSON or YAML manifests. CI pipelines like GitHub Actions accept YAML key-value blocks. Moving secrets and settings between these formats by hand is tedious and error-prone. This tool handles the conversion in both directions: paste a .env file and get clean JSON or YAML, or paste a JSON config and get a .env file you can source directly. The parser handles the real-world edge cases that trip up naive converters: lines starting with the export keyword, values wrapped in single or double quotes, double-quoted values with escape sequences like \n and \t, empty values, and inline comments after values. Nested JSON and YAML objects are flattened to PARENT__CHILD keys using a double-underscore delimiter, and the reverse direction expands them back.

Frequently Asked Questions

How are nested objects handled?

Nested JSON or YAML objects flatten to keys like PARENT__CHILD by default (double underscore delimiter). The reverse direction expands them back. This matches the convention used by many frameworks for hierarchical config in environment variables.

Does it keep my comments?

Comments in .env files are read and then discarded during parsing. JSON and YAML have no equivalent inline comment position, so they cannot be carried into structured output.

Are quoted values handled?

Yes. Single and double quotes are stripped from values. Inside double-quoted values, standard escape sequences like \n, \t, and \\ are expanded, matching the behavior of the dotenv specification.

Is export KEY=value supported?

Yes. The export prefix is recognized and dropped. Keys with and without the prefix are treated identically.

Does my config leave the browser?

No. Parsing and conversion run entirely client-side. This matters because .env files often contain API keys, database passwords, and other secrets that should never be sent to a third-party server.

Related Tools