YAML to dotenv

Paste YAML config and instantly get flattened .env KEY=VALUE lines, with nested keys joined by underscores.

Use the YAML to dotenv

Nested keys flatten

Nested mappings become underscore-joined, uppercase env var names.

100% client-side

Your data never leaves the browser. Safe for secrets and API keys.

Auto-quoted values

Strings with spaces or special characters are wrapped in double quotes automatically.

Summary

This tool converts a YAML configuration file into .env (dotenv) format. Flat keys map directly to KEY=VALUE lines, and nested mapping keys are flattened into a single UPPER_SNAKE_CASE name joined by underscores. Arrays of plain values are joined into one comma-separated line. The conversion runs entirely in your browser, so secrets never leave your device.

How it works

  1. Paste or type your YAML configuration into the input panel.
  2. The tool parses the YAML client-side using the js-yaml library.
  3. Nested mapping keys are flattened into UPPER_SNAKE_CASE names joined by underscores, so database.host becomes DATABASE_HOST.
  4. Arrays of plain values are joined into a single comma-separated line; arrays containing objects are skipped with a warning.
  5. String values with spaces or special characters are wrapped in double quotes automatically.
  6. Click "Copy" or "Download" to grab the resulting .env file.

Use cases

  • Convert a nested YAML config, such as a Kubernetes ConfigMap or app.yaml file, into a .env file for local development.
  • Generate environment variable definitions from a YAML secrets export.
  • Prepare .env files for Docker, CI/CD pipelines, or serverless functions from an existing YAML config.
  • Flatten nested YAML sections into prefixed environment variable names without hand-editing.
  • Migrate a Helm values.yaml file into environment variables for a container.
  • Preview how a YAML config would look once flattened, before committing a .env file to a repository.

Frequently Asked Questions

Last updated: 2026-09-09 · Reviewed by Nham Vu