Skip to content

Developers

Env YAML Converter

Env YAML Converter

Beta

Convert a .env file to a flat YAML map, or to a pasteable Docker Compose or GitHub Actions env block, and back. Runs in your browser; secrets are not uploaded.

Use via API
  • Free, no sign-up
  • REST + MCP
  • Updated
  • Reviewed by Olgun Ozoktas

The .env text is converted in your browser and is not uploaded to FindUtils. Analytics and ads may load on the page. Prefer your platform's secret storage over committing real production values into YAML.

.env
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
YAML

The YAML will appear here..

How to convert a .env file to YAML

  1. Paste or upload the .env

    Paste the file into the left panel or upload it. Comments, blank lines and a leading export are handled, and the samples are a Node, a Laravel and a CI style file.
  2. Pick the shape

    Plain map is a flat mapping of names to values. Compose wraps it under services.app.environment and Actions under jobs.app.env, each a snippet to paste into a real file rather than a complete one.
  3. Decide on types

    Values stay strings by default, which is what process.env hands back. Turn on Numbers and booleans if the consumer expects real YAML types, and remember that a quoted value in the .env is never retyped.
  4. Copy or download

    Copy the YAML or download env.yaml. Switch the direction to flatten a YAML map back into KEY=value lines; a Compose or Actions snippet is recognised and unwrapped.

Common Use Cases

Filling a Compose environment block

A local .env becomes the environment map a service needs, with the same names and the quoting YAML requires.

Seeding a workflow env map

Non-secret build variables such as a Node version or a build target move into a jobs env block in one paste.

Reading a values map back as .env

A YAML map handed to you by a platform becomes a .env you can run locally, with values quoted only where they need it.

Auditing a file for duplicates

A .env with the same key twice keeps the last value silently. The duplicate report names the key and every line it appeared on.

Why convert a .env into YAML in the browser?

Promoting a local .env into a Docker Compose environment block or a GitHub Actions env map is retyping: the same names and values, in a different shape, with YAML quoting rules that differ from dotenv's. Doing it by hand across twenty keys is slow and the kind of task where one typo costs a failed deploy. The alternative most people reach for is a web converter, and a .env is exactly the file that should never go into an upload form. This page reuses the dotenv parser behind the Env JSON Converter, writes a flat YAML map or one of two snippet shapes, and reads a flat map back into KEY=value lines, without the text leaving the tab.

A dotenv file and a YAML environment block hold the same thing and write it differently. FindUtils' Env YAML Converter moves between them in the browser, reusing the same dotenv parser as the Env JSON Converter: comments, blank lines, a leading export, single and double quoting, escapes, and duplicate keys where the last one wins and every occurrence is reported.

The output shape is the useful part. Plain map is a flat mapping. Compose wraps the keys under services.app.environment and Actions under jobs.app.env — each labelled as a snippet to paste into a real file, because generating a whole compose file or workflow from a list of variables would be guessing at everything else in it. Values stay strings by default, matching what a process actually receives, with an option to promote numbers and booleans when the consumer wants real types.

The reverse direction takes a flat mapping, or one of those snippet shapes, and writes KEY=value lines with quoting applied only where a value needs it. A nested value is refused with a message instead of being flattened into a name you never chose. This is not a Kubernetes Secret generator, it does not expand shell variables, and it will not tell you it is safe to commit a production key — prefer your platform's secret storage for that. For linting an existing file, the Env Linter is the neighbour.

How it compares

The chain most people use is Env to JSON, then JSON to YAML, on two pages, with the secrets pasted twice. Doing it in one step halves that and keeps the dotenv rules intact, including the quoting that decides whether a value is retyped. Compared with a shell one-liner, the page handles quoted values and duplicates rather than splitting on the first equals sign.

It is deliberately narrower than the tools that generate whole manifests. It will not write a Kubernetes Secret, a Helm values tree or a complete compose file, because each of those needs decisions about fields this page knows nothing about. It shapes the variables and says so.

Env and YAML Tips

  • Keep real secrets out of committed YAML. Use the platform's secret storage and reference it; this page is for shaping the file, not for publishing credentials.
  • The Compose and Actions shapes are snippets, not whole files. Paste the block into the real compose file or workflow rather than saving it as one.
  • Leave Numbers and booleans off when the consumer reads environment variables, because every environment variable is a string to the process that receives it.
  • A value with a space, a hash or a quote is written back to .env in double quotes, so it survives a re-read. A plain value is left unquoted.
  • Going back from YAML accepts a flat mapping of scalars. A nested value is refused rather than flattened into an invented name such as DB__HOST.

Frequently Asked Questions

Are the Compose and Actions outputs complete files?

No, and the page labels them as snippets. They are the environment block and the surrounding keys needed to show where it sits, meant to be pasted into a real compose file or workflow that already has its images, steps and triggers.

Why are my values quoted strings in the YAML?

Because environment variables are strings to the process that receives them, so PORT=3000 is the string 3000. Turn on Numbers and booleans if the consumer expects real YAML types. A value that was quoted in the .env is never retyped.

Is it safe to put real secrets in the YAML this produces?

Converting them here is safe because nothing is uploaded. Committing them is a different question, and the answer is usually no. Use your platform's secret storage and reference the secret from the workflow or compose file instead of writing the value into a file that lives in the repository.

What happens to a duplicate key?

The last value wins, which is what dotenv loaders do, and the key is listed under Warnings with every line it appeared on. Nothing is dropped silently.

Can it convert a nested YAML tree back into a .env?

No, and that is deliberate. A nested value is refused with a message. Flattening it would mean inventing a naming convention such as DB__HOST that your application may not use, and a wrong variable name fails at runtime rather than here.

Does it understand the export prefix?

Yes. A leading export is stripped when reading, and there is a toggle to write it back on the return trip for a file meant to be sourced by a shell.

Is my .env uploaded?

No. Parsing and writing happen in your browser and no request carries the text, which is the reason this page exists rather than a server-side converter. Third-party analytics and ads may load on the page, as on the rest of the site.

Does it expand ${OTHER_VAR} references?

No. The value is carried across exactly as written, references included, because expansion rules differ between dotenv libraries and a shell. Whatever reads the file does the expansion.

What YAML shapes does the reverse direction accept?

A flat mapping of scalars, or one of the shapes this tool writes: an environment or env map at the root, a Compose services block, or an Actions jobs block. The shape it recognised is reported with the result.

How is this different from the Env JSON Converter?

That tool writes JSON and this one writes YAML, plus the Compose and Actions snippet shapes. Both read the same dotenv rules. Use that one when a program consumes JSON, this one when a config file consumes YAML.

Rate This Tool

0/1000

Get Weekly Tools

Suggest a Tool