.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

Learn

.env Key Sorter Guide

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?
Without Align values and Drop duplicate keys, recognized key lines are moved as text. The tool removes blank lines. Align values adds spaces before =, and Drop duplicate keys removes earlier entries—either change may matter to a particular config loader.
Which duplicate value wins?
When Drop duplicate keys is checked, this tool keeps the last matching entry (respecting Ignore case). Do not assume your application’s loader handles duplicates in the same way.
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.