Skip to content
ToolsOnDuty - free online tools
Developer Tools

.env to JSON Converter

Convert a .env file to a JSON object and back, handling comments and quotes.

Free foreverRuns in your browserNo sign-up

Comments and quotes are handled. Conversion runs locally, so secrets never leave your browser.

About the .env to JSON Converter

A .env file stores configuration as KEY=value lines. Sometimes you need that same config as JSON, or you have JSON and want a .env file.

This tool converts both ways, ignoring comments, trimming whitespace and stripping surrounding quotes so the result is clean.

Conversion runs locally, so secrets in your config never leave your browser.

Key features

  • Two-way .env and JSON conversion
  • Ignores comments and blank lines
  • Handles quoted values and export prefixes
  • Local, private conversion

How to use

  1. 1Choose the direction: .env to JSON or JSON to .env.
  2. 2Paste your content.
  3. 3Copy the converted result.

Examples

.env to JSON
Input: PORT=3000
Output: { "PORT": "3000" }

Each KEY=value line becomes a string property in the JSON object.

Frequently asked questions

Are comments preserved?
Comment lines starting with # are ignored when converting to JSON, since JSON has no comments. Blank lines are skipped too.
How are values typed?
All .env values are strings, so they become JSON strings. When converting JSON to .env, values are written back as plain text and quoted only if they contain spaces or special characters.
Is my config uploaded?
No. Everything is converted in your browser, so secrets in your .env stay on your device.