Environment variable
An environment variable is a named value that is available to a running program, set either by the shell that launched it, a config file, or another program that started it. Programs read environment variables instead of hardcoding values, so the same code can run with different settings or credentials.
Why it matters
Environment variables are visible to the process they are set for, and to anything that process explicitly passes them to. Running printenv or echo $SOME_KEY in a terminal will print any variable set in that session, including secrets.
Are environment variables encrypted?
No, they are held in the process's own memory in plain text. Anything with permission to inspect that process's environment can read them.
Do environment variables survive a restart?
Only if something sets them again, either your shell profile, a .env file, or a tool like Claude Keychain injecting them at launch.
Related
Looking for a different way to manage your keys? See the best Claude Code API key manager alternatives, or browse every term in the glossary.