Skip to content

Guide · Reviewed 2026-09-04

.env vs .env.local vs .env.production

.env usually supplies shared defaults, .env.local commonly holds machine-specific overrides, and .env.production commonly supplies production-mode configuration. Those meanings are conventions, not a universal standard: precedence and whether a file is loaded at all depend on your framework and command.

Written and reviewed by EnvDesk product team. Last updated .

How do the common filenames differ?

A base file is often loaded broadly, mode-specific files target a runtime mode, and local suffixes override values for one machine. Some frameworks deliberately exclude certain local files during tests.

Which file wins?

There is no universal answer. Next.js and Vite document different lookup rules, while other libraries may load only the path you give them. Consult the loader's current documentation and test the effective configuration.

What belongs in version control?

Commit only files whose contents are intentionally shareable. Teams often commit an example or safe defaults while ignoring local and credential-bearing variants.

Primary sources