# dotenv

Canonical page: /glossary/dotenv

API keys & secrets glossary, Keys & secrets. dotenv: The Convention Behind the .env File

**Short answer:** dotenv refers both to the .env file convention itself and to the small libraries, such as python-dotenv or the Node.js dotenv package, that read a .env file and load its contents into a program's environment variables at startup.

## Why it matters

A dotenv library does nothing to protect the file's contents, it simply parses key-value pairs from text and sets them as environment variables, so all the usual risks of a .env file, being committed by accident or read by anything else on the machine, still apply.

## In Claude Keychain

For Claude Code specifically, Claude Keychain removes the need for a dotenv setup entirely: there is no file for a library to load, because the key comes from the macOS Keychain at the moment it is needed.

## Common questions

**Do I need a dotenv library if I use Claude Keychain?**

Not for the keys Claude Code uses. You may still use one for other, non-secret configuration.

**Is dotenv a security tool?**

No, it is a convenience for local development, not a way to protect a secret's value.

## Related

[.env file](/glossary/env-file), [Environment variable](/glossary/environment-variable), [Secret leaked in git history](/glossary/secret-in-git-history)
