YAML ⇄ .env Converter
About YAML ⇄ .env
YAML ⇄ .env converts between nested YAML configuration and flat process environment variables with an explicit, reversible nesting convention.
How it works
Flatten with double underscores
YAML mappings become variable paths joined by __, such as database.host becoming DATABASE__HOST. Key normalization and collision checks prevent silent overwrites.
Quote values safely
Whitespace, comment characters, empty strings, newlines and JSON array text are double-quoted and escaped. Simple values remain readable without unnecessary quotes.
Rebuild nested YAML
.env parsing supports export prefixes, single and double quotes, inline comments and multiline quoted values. Values remain strings by default, with optional conservative JSON-style type inference.
Frequently asked questions
Why use __ instead of a single underscore?
A double underscore distinguishes nesting from underscores that are already part of a variable or key name.
Are duplicate .env variables allowed?
No. The converter reports the duplicate and its line rather than silently applying last-one-wins behavior.
Are arrays supported?
YAML arrays are stored as JSON text in one environment value and can be restored when type inference is enabled.
Sources & last verified
The behaviour of this tool and the claims on this page were checked against the specifications below on . Everything runs in your browser, so the output you see is exactly what the engine produced.
Found a wrong result or an outdated claim? Report an error and it will be re-verified.