Our thinking

Sort Firefox Containers Alphabetically

I use Firefox containers a lot when I’m working for a number of different clients – e.g. I’ll have a container in Firefox for each regular client so I can log into their Microsoft 365 or Google Workspace tenancy and have it remember me so I don’t have to use MFA every single time.

While containers are great, it really annoys me that there’s no way to easily manage them. Ideally I want a way to sort them alphabetically, however in the absence of this even the ability to drag them to reorder them would be good.

Fortunately there’s a quick and easy way to do it that doesn’t involve manually editing the containers.json file. For this you need to have the command line tool jq installed.

In Firefox, type about:profiles in the address bar and open your profile folder.
Next, QUIT FIREFOX. This is very important.
In Terminal, navigate to your profile folder and type the following two commands:

jq '.identities |= sort_by(.name)' containers.json > containers_sorted.json
mv containers_sorted.json containers.json

This uses jq to sort the identities array in the containers.json file by the name field and output the results to a temp file. You then use mv to replace the original file with the sorted file. A more prudent person than I am would also take a backup of the containers.json file before running jq over it.

After doing this, launch Firefox and marvel as your containers are now sorted alphabetically.

Leave a Reply