ENV Formatter
Normalize quoting, remove duplicate assignments, and optionally sort variables into a consistent file.
Practical guide
How to format a dotenv file
Normalize a dotenv file so configuration changes are easier to review. Choose a quote policy, preserve or remove comments, and sort variables without uploading the file.
- 1Paste or load the unformatted ENV file.
- 2Choose smart, always, or never quoting and decide whether to keep comments and order.
- 3Review the formatted result, then copy or download it as a new file.
What this tool handles
- Consistent quoting for spaces and special characters
- Alphabetical ordering or original assignment order
- Comment preservation or removal
- Duplicate keys collapsed to their last valid assignment
- Unsafe unquoted values rejected instead of silently changed
Example
Before PORT = 3000 APP_NAME=My App PORT=4000 After APP_NAME="My App" PORT=4000
Frequently asked questions
Will formatting change ENV values?
Smart quoting preserves parsed values while normalizing their representation. The no-quotes option refuses values that would become unsafe without quotes.
Which duplicate assignment is kept?
EnvSift keeps the last valid assignment for a duplicate key, matching the precedence used by many dotenv loaders.
Can comments stay in their original positions?
Yes, when original order is selected. With alphabetical sorting, comments are collected above the sorted assignments so they are not attached to the wrong key.