.env Key Sorter
Sort the keys in a .env file alphabetically, keeping each comment with its key and optionally dropping duplicates or aligning values.
.env Key Sorter
Comments stay attached to the key below them and the top comment block stays first, so notes do not drift to the wrong setting. Sorting happens in the page; nothing is uploaded.
Sorted
History for this tool
The most recent data you entered in this tool, stored only in this browser.
Save what you type here, in this browser? Your work would go into this browser's local storage, so a refresh or a trip to another tool does not wipe it. You also get a short list of previous entries under the form, each one restorable with a click. Nothing is ever uploaded, and there is no account.
Being straight about the trade-off: anything kept there can be read by anyone who can use this browser profile, and by any script that later runs on this site. A tool page can hold a private key, a password or a signed token. Saving is convenient; it is not private.
About this tool
Put a .env file in alphabetical order without shuffling the comments that belong to each setting. The top comment block stays first, a comment above a key travels with that key, and blank lines are closed up. Duplicate keys can be collapsed to the last value, and the equals signs can be lined up for a tidier read.
Questions
- Does it change the values?
- No. Only whole lines are moved, so spacing, quotes and inline comments inside a value are untouched. Alignment only pads the space before the equals sign.
- Which duplicate value wins?
- The last one, which is what most .env loaders use when a key appears twice.
- Is my file uploaded?
- No. The file is read, sorted and written in the browser; nothing leaves the page.
- Does it understand export?
- Yes. A line like export PORT=3000 is still recognised as the PORT key and keeps its export prefix.