5

I want to move to Firefox from Chrome. Is there a simple way to export the saved passwords and bookmarks in Chrome and to import them into Firefox?

7 Answers 7

1

The Simplest, Fastest & Bug-free Way:

  • Install Xmarks add-ons in both browsers for Bookmarks sync. After first sync, uninstall it if you no longer wish to keep bookmarks in sync with both browsers.
  • Install LastPass for passwords sync. Its not exact sync between browsers. It simply imports all non-secure passwords (what browsers store) to its own encrypted container (and, cloud), then you can use it universally on any browser, OS and computer. If you want pure export in which passwords should be handled by Firefox, export passwords to Firefox after import. Then, you can uninstall LastPass if you wish.
3

The Bookmark part is easy:

Method 1:

Import directly from Firefox's Bookmark Manager.

Method 2:

Export bookmark to .html file from Chrome's Bookmark Manager

Then import the .html file in Firefox's Bookmark Manager.


The Password part is hard, I don't know.

3

For exporting/import passwords, if you are running Linux this Python script will provide a solution:

https://github.com/spookylukey/gnome-keyring-import-export/blob/master/gnome_keyring_import_export.py

3
  • 1
    When providing an answer, rather than giving a link, can you include the main points made within the link which answer the question. Thanks. Mar 7, 2014 at 10:39
  • 1
    The "main points" are a script. I'll link to that directly. Mar 7, 2014 at 14:41
  • Tried the link: "This repository has been deleted" Aug 19, 2020 at 9:18
2

I know this would be a complete pain but I'll suggest it.

I'd recommend Lastpass(firefox) for distributing bookmarks. While you can't import existing bookmarks (I've never come across something like that) you can share it across multiple computers/platforms/devices.

If you have forgotten what your password is for a website, you can easily find out via Chrome Password storing thing.

You can find it by Clicking the little Spanner > Options > Personal Stuff > Manage Passwords.

Just browse normally, you'll eventually add all that you actually need.

For the Export, get a html from Chrome using:

  1. Ctrl + Shift + O
  2. Organize (click)
  3. Export bookmarks HTML

For the Import:

  1. Ctrl + Shift + B
  2. Import Export (at the top)
  3. Browse for your saved bookmarks.html

Out of curiosity, I'd like to know why you're moving to Firefox. I just moved from Firefox to Chrome for a test run :P

1
  • I want to use the same browser on my laptop and mobile devices.
    – Joachim
    Mar 11, 2012 at 16:08
0

The actual script itself from spookyLurky's link:

(https://bitbucket.org/spookylukey/gnome-keyring-import-export/src/default/gnome_keyring_import_export.py)

#!/usr/bin/env python

# Simple script for exporting gnome2 (seahorse) keyrings,
# and re-importing on another machine.

# Usage:
#
# 1) Export:
#
#   gnome_keyring_import_export.py export somefile.json
#
#
# Please note - this dumps all your passwords *unencrypted*
# into somefile.json
#
# 2) Import:
#
#   gnome_keyring_import_export.py import somefile.json
#
#   OR
#
#   cat somefile.json | gnome_keyring_import_export.py import
#
# This attempts to be intelligent about not duplicating
# secrets already in the keyrings - see messages.
#
# However, if you are moving machines, sometimes an application
# name changes (e.g. "chrome-12345" -> "chrome-54321") so
# you might need to do some manual fixes on somefile.json first.
#
# Please make BACKUP copies of your existing keyring files
# before importing into them, in case anything goes wrong.
# They are normally found in:
#
#  ~/.gnome2/keyrings
#  ~/.local/share/keyrings
#
#
# 3) Export Chrome passwords to Firefox
#
# This takes Chrome passwords stored in the Gnome keyring manager and creates a
# file than can be imported by the Firefox "Password Exporter" extension:
# https://addons.mozilla.org/en-US/firefox/addon/password-exporter/
#
#   gnome_keyring_import_export.py export_chrome_to_firefox somefile.xml
#



import json
import sys
import urlparse

import lxml.etree
from lxml.etree import Element
import pygtk
pygtk.require('2.0')
import gtk # sets app name
import gnomekeyring

def mk_copy(item):
    c = item.copy()
    c['attributes'] = c['attributes'].copy()
    return c

def remove_insignificant_data(item, ignore_secret=False):
    item.pop('mtime', None)
    item.pop('ctime', None)
    item.pop('mtime', None)
    item['attributes'].pop('date_created', None)
    if ignore_secret:
        item.pop('secret', None)

def items_roughly_equal(item1, item2, ignore_secret=False):
    c1 = mk_copy(item1)
    c2 = mk_copy(item2)

    remove_insignificant_data(c1, ignore_secret=ignore_secret)
    remove_insignificant_data(c2, ignore_secret=ignore_secret)

    return c1 == c2

def export_keyrings(to_file):
    file(to_file, "w").write(json.dumps(get_gnome_keyrings(), indent=2))

def get_gnome_keyrings():
    keyrings = {}
    for keyring_name in gnomekeyring.list_keyring_names_sync():
        keyring_items = []
        keyrings[keyring_name] = keyring_items
        for id in gnomekeyring.list_item_ids_sync(keyring_name):
            item = get_item(keyring_name, id)
            if item is not None:
                keyring_items.append(item)

    return keyrings

def export_chrome_to_firefox(to_file):
    """
    Finds Google Chrome passwords and exports them to an XML file that can be
    imported by the Firefox extension "Password Exporter"
    """
    keyrings = get_gnome_keyrings()
    items = []
    item_set = set()
    for keyring_name, keyring_items in keyrings.items():
        for item in keyring_items:
            if (not item['display_name'].startswith('http')
                and not item['attributes'].get('application', '').startswith('chrome')):
                continue
            items.append(item)

            attribs = item['attributes']
            item_def = (attribs['signon_realm'],
                        attribs['username_value'],
                        attribs['action_url'],
                        attribs['username_element'],
                        attribs['password_element'],
                        )
            if item_def in item_set:
                sys.stderr.write("Warning: duplicate found for %r\n\n" % (item_def,))
            item_set.add(item_def)

    xml = items_to_firefox_xml(items)
    file(to_file, "w").write(xml)

def items_to_firefox_xml(items):
    doc = Element('xml')
    entries = Element('entries',
                      dict(ext="Password Exporter", extxmlversion="1.1", type="saved", encrypt="false"))
    doc.append(entries)
    for item in items:
        attribs = item['attributes']
        url = urlparse.urlparse(attribs['signon_realm'])
        entries.append(Element('entry',
                               dict(host=url.scheme + "://" + url.netloc,
                                    user=attribs['username_value'],
                                    password=item['secret'],
                                    formSubmitURL=attribs['action_url'],
                                    httpRealm=url.path.lstrip('/'),
                                    userFieldName=attribs['username_element'],
                                    passFieldName=attribs['password_element'],
                                    )))
    return lxml.etree.tostring(doc, pretty_print=True)

def get_item(keyring_name, id):
    try:
        item = gnomekeyring.item_get_info_sync(keyring_name, id)
    except gnomekeyring.IOError as e:
        sys.stderr.write("Could not examine item (%s, %s): %s\n" % (keyring_name, id, e.message))
        return None
    return {
        'display_name': item.get_display_name(),
        'secret': item.get_secret(),
        'mtime': item.get_mtime(),
        'ctime': item.get_ctime(),
        'attributes': gnomekeyring.item_get_attributes_sync(keyring_name, id),
        }


def fix_attributes(d):
    return {str(k): str(v) if isinstance(v, unicode) else v for k, v in d.items()}


def import_keyrings(file_p, file_name):
    keyrings = json.loads(file_p.read())

    for keyring_name, keyring_items in keyrings.items():
        try:
            existing_ids = gnomekeyring.list_item_ids_sync(keyring_name)
        except gnomekeyring.NoSuchKeyringError:
            sys.stderr.write("No keyring '%s' found. Please create this keyring first" % keyring_name)
            sys.exit(1)

        existing_items = [get_item(keyring_name, id) for id in existing_ids]
        existing_items = [i for i in existing_items if i is not None]

        for item in keyring_items:
            if any(items_roughly_equal(item, i) for i in existing_items):
                print "Skipping %s because it already exists" % item['display_name']
            else:
                nearly = [i for i in existing_items if items_roughly_equal(i, item, ignore_secret=True)]
                if nearly:
                    print "Existing secrets found for '%s'" % item['display_name']
                    for i in nearly:
                        print " " + i['secret']

                    print "So skipping value from '%s':" % file_name
                    print " " + item['secret']
                else:
                    schema = item['attributes']['xdg:schema']
                    item_type = None
                    if schema ==  u'org.freedesktop.Secret.Generic':
                        item_type = gnomekeyring.ITEM_GENERIC_SECRET
                    elif schema == u'org.gnome.keyring.Note':
                        item_type = gnomekeyring.ITEM_NOTE
                    elif schema == u'org.gnome.keyring.NetworkPassword':
                        item_type = gnomekeyring.ITEM_NETWORK_PASSWORD

                    if item_type is not None:
                        item_id = gnomekeyring.item_create_sync(keyring_name,
                                                                item_type,
                                                                item['display_name'],
                                                                fix_attributes(item['attributes']),
                                                                item['secret'],
                                                                False)
                        print "Copying secret %s" % item['display_name']
                    else:
                        print "Can't handle secret '%s' of type '%s', skipping" % (item['display_name'], schema)


if __name__ == '__main__':
    if len(sys.argv) == 3:
        if sys.argv[1] == "export":
            export_keyrings(sys.argv[2])
        if sys.argv[1] == "import":
            file_name = sys.argv[2]
            import_keyrings(file(file_name), file_name)
        if sys.argv[1] == "export_chrome_to_firefox":
            export_chrome_to_firefox(sys.argv[2])
    elif len(sys.argv) == 2 and sys.argv[1] == "import" and not sys.stdin.isatty():
        import_keyrings(sys.stdin, "stdin")

    else:
        print "See source code for usage instructions"
        sys.exit(1)
0

Update for 2018: LastPass export just creates a custom CSV file that is not compatible with Firefox. I somehow managed to do it, but I had an old Firefox version on my windows machine, and I don't know if it's currently possible to download old version of Firefox on purpose.

Having said that, what I did was:

  1. Install Python if you don't have it
  2. Go to chrome and export all passwords in a csv file (let's call it mypass.csv).
  3. Move it on desktop.
  4. Log-in from my old firefox browser
  5. Install Password Exporter (not working for newer Firefox version)
  6. Create a new file using Notepad (Windows) or TextEdit (Mac), calling it file.py
  7. copy the following snippet in the newly created file:

    file="mypass.csv"
    print("""# Generated by Password Exporter; Export format 1.1; Encrypted: false
    "hostname","username","password","formSubmitURL","httpRealm","usernameField","passwordField" """ )
    # name, url, username, password
    for line in open(file):
        l=line.split(',')
        name = "https://" + l[0]
        url = l[1]
        username = l[2]
        password = l[3].strip()
        print('"'+name+'",'+'"'+username+'",'+'"'+password+'",'+ '"'+url+'",'+'"","",""')
    
  8. Open terminal, go to the Desktop folder, execute python mypass.csv > firefox_pass.csv

  9. Open firefox, go to Security -> Import/Export Passwords (available only to old version of Firefox) -> Import CSV file -> select firefox_pass.csv located on Desktop

  10. Allow Firefox to sync. In this way, all other firefox devices (also newer!) will sync your passwords.

0

Firefox can read the bookmarks and passwords directly from Chrome. Go to Library --> Bookmarks --> Show All Bookmarks --> Import and Backup --> Import Data from Another Browser and select Chrome

If it's on another computer, you can temporarily install Firefox, import the settings, and then use FEBE extension to transport them to the other copy of Firefox.

You must log in to answer this question.

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