I want to export my saved passwords in Firefox/Mozilla manager to an external password manager application with better encryption.

Where is the password file located and what is the file extension? Maybe the application can do an import of the database file.

5 Answers 5


The latest versions of Firefox store passwords, encrypted, in a JSON text file, logins.json, in your Firefox profile folder at /home/you/.firefox/ or /home/you/.mozilla/firefox.

This Python script will decrypt them all into a text file. Basic usage:

python firefox_decrypt.py

And answer prompt if necessary. Hit Enter on "master password" question if none set.

Update to clarify how. Do this in your home directory.

  1. wget https://raw.githubusercontent.com/unode/firefox_decrypt/master/firefox_decrypt.py (get raw script)
  2. python firefox_decrypt.py > out.json (export logins to file)
  • Of the various responses, I believe your suggestion is the easiest to implement. So I tried the script you suggested. However, I noticed that it does not show a choice for all my profiles in various places. It comes up with two and neither is the correct one. I tried placing the script in the directory where the profile's json file is located, but it appears to make no difference. Not being a python programmer, I am unclear as to how to adapt the script if necessary, even if I knew what was wrong. I am using Xubuntu 14.04.5 with Firefox 49.0.2. Thank you.
    – Searcher
    Nov 2, 2016 at 15:25
  • Look at the function parse_sys_args near the bottom, this seems to be where it hard-codes the profile_path. Try changing that to the correct path for your profile. Better, make sure that there is a profiles.ini file at that path, and edit it to indicate where your profiles are. That way you will not need to hack the script.
    – Sqerstet
    Nov 3, 2016 at 0:36
  • 2
    Original author of firefox_decrypt here. Replying to a somewhat old post but for those landing here, the README explains how to provide a non-standard location. Simply give the path to your profile as an argument to the script python firefox_decrypt.py /my/firefox/profile/
    – unode
    Mar 22, 2018 at 14:04
  • @unode This throws the following error for me: Traceback (most recent call last): File "firefox_decrypt.py", line 46, in <module> PWStore = list[dict[str, str]] TypeError: 'type' object is not subscriptable
    – Peaceful
    Jul 1, 2022 at 11:58

With reference to answer above by @Sqerstet I simply downloaded the script firefox_decrypt.py, saved it on my Desktop and created a text file too on Desktop and then ran following commands:

jignesh@j-home-pc:~/Desktop$ python firefox_decrypt.py > my_pass.txt 

Master Password for profile /home/jignesh/.mozilla/firefox/nfa9v0da.default: (I didn't had one so I left it blank and hit Enter)
2018-02-01 12:25:07,223 - WARNING - Attempting decryption with no Master Password


And hurray I got all my saved login creds in plain format in the text file .

More information about where in Home folder Mozilla saves the data can be found on their support page. Quoting below the section for Passwords below for quick view:

Passwords: Your passwords are stored in the key4.db and logins.json files. For more information, see Password Manager - Remember, delete, change and import saved passwords in Firefox.

BTW before I was using this awesome add-on Password Exporter which was just fit for the Import and Export of Saved Passwords. Unfortunately this add is incompatible with Firefox Quantum version and hence I had to find some alternate solution and I ended up here and found the firefox_decrypt.py script the most easy to use compared to other offered Add-ons like

  • LastPass Password Manager
  • Roboform Password Manager


To me they felt too much for my purpose of just exporting my passwords.



There is an add-on for exporting your passwords.


  • 3
    Unfortunately, this script does not work with recent (≥57 I think) versions of Firefox... Mar 11, 2018 at 10:54

According to the support page the password data can be found in ~/.mozilla/firefox/key4.db and ~/.mozilla/firefox/logins.json files. These files needs to be read with some sqlite editor. There are other alternatives like extensions that do so too.

LastPass, Keepass and others password managers that use Firefox plugins, can import the data from Firefox directly and replace the password manager.

  • No signons.sqlite as of Firefox 86. Is key4.db used? The top answer doesn't mention it. Mar 2, 2021 at 9:36
  • @DanDascalescu the support page says that logins and key4 are used.
    – Braiam
    Mar 2, 2021 at 10:24

LastPass Password Manager is a very good add-on that let's you store and encrypt your passwords in Firefox. It automatically exports (and deletes) the passwords stored locally and plainly during installation to your LastPass Vault. It also has a feature for generating a random password for a particular website.

This, for me, is one of the best security add-ons for Firefox. It's easy to use and manage.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .