Merge & Clean
Combine two ENV files into one sorted result. Duplicate keys are collapsed and your chosen file wins when values conflict.
0 final variables0 value conflicts
Practical guide
How to merge and clean .env files
Combine two dotenv files into one stable result. You control which file wins conflicting values or resolve each conflict manually.
- 1Load the lower- and higher-priority ENV files into File A and File B.
- 2Choose a winning file for all conflicts, or select manual resolution.
- 3Review conflicts and download the alphabetically sorted merged file.
What this tool handles
- Keys present in only one source file
- Identical assignments collapsed into one line
- Different values resolved by explicit precedence
- Duplicates within each file removed before merging
- Malformed input rejected with the source file and line number
Example
File A PORT=3000 LOG_LEVEL=debug File B PORT=8080 API_URL=https://api.example.com File B wins API_URL=https://api.example.com LOG_LEVEL=debug PORT=8080
Frequently asked questions
Which file wins conflicts by default?
File B wins by default. Change the selector to File A or manual resolution before using the output.
Does merging preserve comments?
No. Merge output is a clean, sorted set of assignments. Use the formatter when preserving comments is important.
Can EnvSift merge more than two files at once?
The merge tool handles two files so precedence stays explicit. Merge the result with another file when a third layer is needed.