What is an environment variable?

Definition

An environment variable lets an operating system, runtime, or hosting platform provide configuration when an application starts. Common uses include service endpoints, feature flags, environment names, and references to credentials that must differ between development, staging, and production.

Environment variables separate configuration from application code, but they are not automatically secure. Sensitive values still require restricted access, careful logging, rotation, and a hosting design that prevents them from being exposed to browsers or unauthorized processes.

Acronyms and aliases

environment configuration variable variant

Frequently asked questions

Why use environment variables for application configuration?

They let the same code run with different deployment settings without embedding those values in the source or rebuilding the application.

Are environment variables a complete secret-management solution?

No. They reduce source-code exposure, but access controls, secret storage, log hygiene, rotation, and runtime isolation are still necessary.

Videos explaining environment variable