Issue 13 · Nov 2–8, 2026Editions · Glossary · Archive · Method · RSS · HU / ENG

News of the AI era, curated weekly

Glossary › Developer basics

.env file

advancedwidespread

The .env file is a simple text file where the program stores its passwords, keys, and settings, separate from the program code.

In plain terms

Imagine that the code of your safe is not written on the safe door but on a separate piece of paper kept at home. The .env file is such a note in the world of programs. It contains secret data (passwords, API keys) and settings that differ per machine. The note itself is not locked: whoever finds it can read it.

The file is very simple: each line contains a name and a value, for example DATABASE_PASSWORD=something. The program reads it at startup and uses the values as if they were runtime environment settings.

This is useful because the code can be safely shared with others or uploaded to a shared repository, while the secrets stay on your own machine. The same program can run on a test machine and on a live server with a different .env file or different settings, without rewriting the code.

Due to AI tools, more people encounter this today than before. Anyone running a program or agent using a language model often needs to enter the key provided by the service provider.

How it works

  1. In the project's main directory, create a file named .env and enter NAME=value pairs line by line.
  2. When the program starts, a small helper library (or the runtime environment itself) reads the file and makes the values available as environment variables.
  3. The code then retrieves values by name, so the password or key does not appear anywhere in it.
  4. The .env file is added to the exclusion list (.gitignore) so the version control system does not upload it to the shared code repository.
  5. For the others, an empty template file (such as .env.example) shows what values they need to provide in their own setup.

An everyday example

You download an open-source chatbot, and the instructions ask you to copy the .env.example file as .env, then enter your own API key. From then on, the program accesses the AI service with your key and consumes from your account.

Who is affected

developerThey use it daily to manage secrets and settings that vary by machine, and it is their job to make sure the file does not leak. → Code
entrepreneur, executiveA leaked .env file can grant access to the company database, paid services, and customer data.
parent, student, teacherAnyone learning to program or trying out an AI project typically encounters it among the first steps. → Education & Family
employeeIf you work with a coding agent or automation tool, you must know that this file is confidential and should not be shared in screenshots or chats. → Work & HR

A common misconception

MythThe .env file is a secure, encrypted storage, so what I write there is protected.
In realityThe .env file is plain, unencrypted text that anyone with access to the machine or the file can read. All it does is keep the secret out of the code, so it doesn't travel with the code when you share it.

Limits and risks

Similar, but not the same

Related concepts

Broader

environment variable, configuration, secret management

Narrower

.env.example file

On the edge

API key, .gitignore, version control, token, coding agent

A brief history

The practice was popularized by the 'Twelve-Factor App' methodology published in 2011. It suggested that settings should be in environment variables, not in the code. dotenv helper libraries were built on this: one appeared for Ruby in 2012, then one for Node.js. Since 2023 (from version 20.6), Node.js can also read the .env file built-in with a separate switch.

Where things stand

At the end of 2026, the .env file is a common solution in most programming languages and development tools, and one of the standard places for API keys in AI projects. Attention has meanwhile shifted to how to protect it from leaks and from agents running on the machine.

Status: 2026 November

Also known as

.env · dotenv · .env file · env file · dotenv file · .env file · environment file · environment file

Sources

This entry was machine-edited and has undergone machine expert review; the “In the news” section updates automatically from Agent Age stories.