.env → JSON Converter
Paste a .env / dotenv file or upload one, then convert KEY=VALUE pairs to JSON.
Supports quotes, optional export, and comments. Everything runs in your browser — nothing is sent to a server.
.env to JSON controls
How it works
Paste a dotenv-style file or upload a .env / text file. The converter reads
KEY=VALUE lines, optional export prefixes, quotes, comments, and empty
values, then builds a JSON object you can copy into apps, CI configs, or docs.
Options let you pretty-print JSON, strip leading export, and decide whether empty
values are kept. Parsing is pure client-side JavaScript — handy when a .env has
secrets you do not want to post to a remote converter.
Use Load sample to see supported syntax, then Clear when you are finished with sensitive content.
When to use this tool
- Turning local
.envexamples into JSON for tools that expect objects - Cleaning
export KEY=VALUEshell snippets into structured config - Quick checks that quotes and comments parse the way you expect
- Documenting non-secret sample env vars as JSON in tickets or READMEs
Tips
- Prefer offline tools for production secrets even though this page does not upload your paste
- Multiline double-quoted values are supported; prefer simple one-line values when possible
- Pair with the JSON Formatter if you need to re-indent the result
Frequently asked questions
What is a .env file?
A .env (dotenv) file stores environment variables as KEY=VALUE lines. Apps and DevOps tools load them for config and secrets without hard-coding values in source.
Does my .env leave my browser?
No. Parsing runs entirely in your browser with JavaScript. Your .env contents are not uploaded to a server. Prefer local tools for production secrets when possible.
Does this support quoted values and export?
Yes. Double and single quotes, optional export KEY=VALUE lines, # comments, and empty values are supported. Multiline double-quoted values are handled.
Is this .env to JSON converter free?
Yes. The Formattly .env to JSON converter is free to use with no signup required.
What does Keep empty values do?
When enabled, keys with blank values are included in the JSON as empty strings. When disabled, those keys are omitted from the output object.