Skip to content
ITG Now
Follow

Home › AI glossary › Environment variable

What is an environment variable?

Short answer

An environment variable is a named setting stored outside your code, often used to hold things like API keys.

  • Category Building with AI
  • Also called .env, env var, env file
  • Updated 20 Oct 2026
Share

Environment variable, explained simply

An environment variable is a labeled value kept by your computer or app. A program can read it when it starts.

It matters because it keeps secrets out of your code. Instead of pasting a key into a file, you store it in a variable.

For example, a tool may say, "Set OPENAI_API_KEY to your key." The tool then reads it from there.

Many projects use a file named .env to keep these settings. Don't share that file or upload it to a public site.

On ITG Now, our free tool guides show which environment variables a tool needs and where to set them.

API keyTerminalCLIDockerYAML

Where you'll see it on ITG Now

Questions people ask about Environment variable

What is a .env file?

It is a text file that holds environment variables for a project. Keep it private.

Is it safe to put my API key in an environment variable?

It is safer than putting it in code. Still, keep it private and don't upload it.

How do I set an environment variable?

It depends on your system. Many tools tell you to add a line to a .env file or use a terminal command.

Sources

Last updated

Share

Browse all 200 AI terms