Env to JSON converter
Paste configuration text to convert between .env and a JSON object of strings. Select how repeated .env names should be handled; conversion stays local.
Convert text locally. JavaScript is required; no input is uploaded or stored.
How it works
Node.js documents its own .env rules because there is no universal specification. This converter follows a documented subset: names contain ASCII letters, digits and underscores and cannot start with a digit. An optional export prefix is ignored. Unquoted values lose surrounding whitespace and end at #; single- or double-quoted values retain whitespace, hashes and literal newlines.
Values remain strings: 3000 and false are not converted to a number or boolean. No variable interpolation or shell execution occurs. Quoted text ends at the next matching quote; escaped quotes are unsupported. Double-quoted backslash-n and backslash-r sequences are rejected because escape handling differs across dialects; use literal newlines or single quotes.
Duplicate .env assignments are reported with a selectable first, last or reject policy. JSON must be an object containing only strings; use unique JSON keys because JSON parsing retains the last repeated key. JSON output loses comments and formatting. For .env output we select a quote absent from the value; values containing both quote types, NUL or carriage returns are rejected. Input and generated .env text are limited to 512 KiB and 10,000 lines. No numeric rounding occurs.
Worked examples
Strings stay strings
PORT=3000 and DEBUG=false become {"PORT":"3000","DEBUG":"false"}.
Duplicates are visible
A=1 followed by A=2 produces {"A":"2"} under last-value policy, with one duplicate reported. First-value policy gives {"A":"1"}.
Frequently asked questions
Does this support every dotenv library?
Will true become a JSON boolean?
Are variables such as ${HOME} expanded?
Can quoted values span lines?
Can I share a link containing this input?
Sources
- HTML Standard — limiting user input length (checked 2026-11-14)
- Node.js — DotEnv names, values, spacing, comments and export (checked 2026-11-14)
Last reviewed 2026-11-14. The method is written out above so you can check our math.