.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

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.