How can I share my Google Chrome search engine entries?

I have created some search entries in Google Chrome using 'Edit search engines'.

How can I share some of these entries with my colleagues?


Edit 2020-07-27:

The export part of this solution does not work anymore in Chrome 84 (the settings object used in the script is no longer available). The import script is not very useful without the export part but it should still work for importing an existing JSON file with the settings or for transfering search engine settings from an older version of Chrome/Chromium to the current version.

Here is a simple solution to export and import Chrome search engine settings without using any external tools or editing the registry:

  1. Open the Search Engine Settings page in Chrome (chrome://settings/searchEngines).
  2. Open Chrome Developer Tools.
  • Shortcut: F12 or Ctrl+Shift+I (on Windows, shortcuts on other platforms may differ).
  • Manual navigation: Three-dot menu in upper-right corner > More Tools > Developer Tools.
  1. Click Console in the top menu bar of Chrome Developer Tools.
  2. Paste one of the following scripts into the console and press Enter.

To download a JSON file with search engine settings:

(function exportSEs() {
  /* Auxiliary function to download a file with the exported data */
  function downloadData(filename, data) {
    const file = new File([data], { type: 'text/json' });
    const elem = document.createElement('a');
    elem.href = URL.createObjectURL(file);
    elem.download = filename;
    elem.click();
  }

  /* Actual search engine export magic */
  settings.SearchEnginesBrowserProxyImpl.prototype.getSearchEnginesList()
    .then((searchEngines) => {
      downloadData('search_engines.json', JSON.stringify(searchEngines.others));
    });
}());

To import settings from a JSON file created using the script above:

(async function importSEs() {
  /* Auxiliary function to open a file selection dialog */
  function selectFileToRead() {
    return new Promise((resolve) => {
      const input = document.createElement('input');
      input.setAttribute('type', 'file');
      input.addEventListener('change', (e) => {
        resolve(e.target.files[0]);
      }, false);
      input.click();
    });
  }

  /* Auxiliary function to read data from a file */
  function readFile(file) {
    return new Promise((resolve) => {
      const reader = new FileReader();
      reader.addEventListener('load', (e) => {
        resolve(e.target.result);
      });
      reader.readAsText(file);
    });
  }

  const file = await selectFileToRead();
  const content = await readFile(file);
  const searchEngines = JSON.parse(content);
  searchEngines.forEach(({ name, keyword, url }) => {
    /* Actual search engine import magic */
    chrome.send('searchEngineEditStarted', [-1]);
    chrome.send('searchEngineEditCompleted', [name, keyword, url]);
  });
}());

Notes

  • I tested the scripts in Chrome 75.0.3770.100 on Windows 8.1.
  • The scripts export and import search enines in the Other Search Engines section only but they can easily be tweaked to include default search engines as well.
  • Do not try to distribute the scripts as bookmarklets, bookmarklets do not execute on chrome:// URLs (been there, done that).

Here's a single command to export your chrome search engines as CSV on linux:

sqlite3 -csv ~/.config/chromium/Default/Web\ Data 'select short_name,keyword,url from keywords' > ~/search-engines.csv

You need sqlite3 installed. Replace ~/.config/chrome with the corresponding Windows path if you're on Windows. Should be something like %AppData%\Local\Google\Chrome\User Data

Exporting as SQL for re-importing elsewhere

Instead of exporting to CSV, you could export to sqlite insert statements:

(printf 'begin transaction;\n'; sqlite3 ~/.config/chromium/Default/Web\ Data 'select short_name,keyword,url,favicon_url from keywords' | awk -F\| '{ printf "insert into keywords (short_name, keyword, url, favicon_url) values ('"'"%s"'"', '"'"%s"'"', '"'"%s"'"', '"'"%s"'"');\n", $1, $2, $3, $4 }'; printf 'end transaction;\n') > ~/search-engine-export.sql

Then copy ~/search-engine-export.sql to the other machine, and import with this command:

sqlite3 ~/.config/chromium/Default/Web\ Data < search-engine-export.sql

Making sure to replace the Web Data path with the one on your machine as described above.


...piggybacking off of https://superuser.com/a/1458616/55621 but trying to update it to work with current versions of Chrome. This worked circa Chrome 88 on a Mac.

To download a JSON file with search engine settings:

(function exportSEs() {
  /* Auxiliary function to download a file with the exported data */
  function downloadData(filename, data) {
    const file = new File([data], { type: 'text/json' });
    const elem = document.createElement('a');
    elem.href = URL.createObjectURL(file);
    elem.download = filename;
    elem.click();
  }

  let searchEngines = [];
  document.querySelector('settings-ui').shadowRoot
    .querySelector('settings-main').shadowRoot
    .querySelector('settings-basic-page').shadowRoot
    .querySelector('settings-search-page').shadowRoot
    .querySelector('settings-search-engines-page').shadowRoot
    .querySelector('settings-search-engines-list#otherEngines').shadowRoot
    .querySelectorAll('settings-search-engine-entry')
    .forEach($el => searchEngines.push(
      {
        name: $el.shadowRoot.querySelector('#name-column').textContent,
        keyword: $el.shadowRoot.querySelector('#keyword-column').textContent,
        url: $el.shadowRoot.querySelector('#url-column').textContent
      })
    )

  downloadData('search_engines.json', JSON.stringify(searchEngines));
}());

To import settings from a JSON file created using the script above:

(async function importSEs() {
  /* Auxiliary function to open a file selection dialog */
  function selectFileToRead() {
    return new Promise((resolve) => {
      const input = document.createElement('input');
      input.setAttribute('type', 'file');
      input.addEventListener('change', (e) => {
        resolve(e.target.files[0]);
      }, false);
      input.click();
    });
  }

  /* Auxiliary function to read data from a file */
  function readFile(file) {
    return new Promise((resolve) => {
      const reader = new FileReader();
      reader.addEventListener('load', (e) => {
        resolve(e.target.result);
      });
      reader.readAsText(file);
    });
  }

  const file = await selectFileToRead();
  const content = await readFile(file);
  const searchEngines = JSON.parse(content);
  searchEngines.forEach(({ name, keyword, url }) => {
    /* Actual search engine import magic */
    chrome.send('searchEngineEditStarted', [-1]);
    chrome.send('searchEngineEditCompleted', [name, keyword, url]);
  });
}());

This is highly likely to break with succeeding versions of Chrome, and there's probably a better way to traverse the dom.


It's possible, but it's enough of a pain that you won't want to.

  1. Find the Web Data file in your Chrome profile. In Windows 7 it will be here: "%USERPROFILE%\AppData\Local\Google\Chrome\User Data\Default\Web Data"

  2. Open the file with an SQLite program like SQLite Studio or sqlite in Ubuntu (sudo apt-get install sqlite) and export the keywords table in SQLite Studio or run this command in Linux: sqlite3 "Web Data" ".dump keywords" > keywords.sql SQLite Studio export dialog

  3. Have your colleagues import the keywords, doing the reverse of this process.

Like I said, possible, but painful.

I wrote a Javascript parser to convert the SQL from Web Data into the nearly universal Netscape Bookmark File Format in HTML (ironic that the definitive standard for that format seems to be Microsoft) if you're interested in getting the keywords into other browsers like Firefox or Opera.

If you're interested in an alternative solution, I created Shortmarks to allow you to use the same set of custom search engines in any browser, and I plan to implement the ability to share with others soon. The upcoming release in a few days will have the import code I mentioned above as soon as I'm finished testing the new features.


I did following to share my Google Chrome search engine entries and it worked perfectly fine for me:

  1. WINDOWS XP: Go to C:\Documents and Settings\MyUserName\Local Settings\Application Data\Google\Chrome\User Data\Default

    ON WINDOWS 7: Go to C:\Users\MyUserName\AppData\Local\Google\Chrome\User Data\Default

  2. Copy these 3 files: Preferences, Web Data and Web Data-journal

  3. Put those 3 files onto the target machine