.env to TOML Converter
Turn a .env file into a structured TOML configuration. DATABASE__HOST=localhost becomes [database] host = "localhost". Booleans and numbers are coerced; quoted values are unwrapped.
When to use it
You've been running a service from a .env file for a while. Now you want to commit a real configuration schema to the repo, with comments, types, and structure. This converter gets you 90% of the way there.
How to use it
- Paste your
.envfile on the left. - Click Convert.
- Review and clean up the TOML — most edits will be adding comments and grouping related keys.
Mapping rules
- Lines starting with
#are treated as comments and skipped. export VAR=valueis accepted; theexportprefix is stripped.- Quoted values (
"...",'...') are unwrapped; backslash escapes are unescaped. true/falsebecome real booleans; pure-numeric values become integers or floats.- Keys with
__(double underscore) are split into nested tables:DB__HOST→[db] host = …. - Output keys are lowercased and emitted as canonical TOML 1.0.
FAQ
What if my keys use single underscores for nesting?
The converter treats single _ as part of the key name. If you want to nest, switch the separator to __ before converting, or post-process the TOML in your editor.
Are array values supported?
No. .env has no array syntax. Values like TAGS=a,b,c come through as strings. Edit the TOML to wrap them in [ ] after conversion.
Will it preserve my comments?
No. Comments are parsed only to be skipped — they don't carry into the TOML tree. Add them back manually in the output.