YAML to .env Converter
Convert nested YAML to a flat .env file. Each nested key joins with an underscore and converts to UPPER_SNAKE. Useful when you have a structured config in YAML but need to load it via environment variables (12-factor app convention).
How to use the YAML to .env Converter
Paste YAML. Nested keys flatten with the chosen separator. Prefix prepends to every key (useful for namespacing in environments shared with other apps). Strings are quoted; numbers and booleans pass through unquoted.
Flattening YAML config into .env
Configuration reads well as nested YAML, but 12-factor apps and most container runtimes inject settings through flat environment variables, so a nested tree has to be flattened — each path joined into a single UPPER_SNAKE_CASE key — before it can be loaded as env vars.
This walks a YAML document and emits a .env file, joining nested keys with an underscore (or a double underscore for the Kubernetes and .NET convention) and optionally prefixing every key to namespace it. To go the other way and rebuild structure from a flat file, the env to YAML converter does that; for JSON output from a .env, the env to JSON converter.
Common use cases
- 12-factor config — turn a YAML config into environment variables.
- Container env — produce a
.envfor Docker or Compose. - Namespace keys — add a prefix to avoid collisions.
- Kubernetes convention — use double-underscore separators for nesting.
- Migrate formats — move a structured config to flat env vars.