Skip to content

Instantly share code, notes, and snippets.

Last active September 12, 2020 18:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skwashd/30c918e43fc741e01077b65bc22c6730 to your computer and use it in GitHub Desktop.
Save skwashd/30c918e43fc741e01077b65bc22c6730 to your computer and use it in GitHub Desktop.
Export stored passwords from Google Chrome to 1Password

This code snippet is for exporting passwords stored in Google Chrome for use in 1Password. It generates a 1Password compatiable CSV file.

NOTE: Your password are exported as plain text. Take proper precautions when storing the file and use a secure deletion tool.

To export your passwords follow these steps:

  • visit chrome://settings-frame/passwords
  • Open the Chrome console (Mac: [Cmd] + [Option] + J / Windows or Linux: [Ctrl] + [Shift] + J`)
  • Paste the code above into the console
  • Enter your password when prompted so your keyring can be unlocked
  • Wait
  • Copy and paste the output to a file ending in .csv
  • Follow the 1Password CSV import guide
  • Let everyone know or buy me a drink to say thanks.

This is a modified version of the code provided by ccpizza to the question How can I export chrome passwords? on superuser. The changes reformat the CSV output so 1Password is happy. I also cleaned up a few things as went.

Licensed under CC-BY-SA-3.0.

var out = [],
pm = PasswordManager.getInstance(),
model = pm.savedPasswordsList_.dataModel,
pl = pm.savedPasswordsList_;
for (var i = 0; i < model.length; i++) {
alert("After you press Ok results should appear in ~5 seconds.\n" +
"If password fields are empty, try increasing the timeout in the last line," +
" i.e. set to 10000 for 10 seconds");
function () {
for (var i = 0; i < model.length; i++) {
var record = model.array_[i],
user = record.username,
proto = record.url.split("://")[0],
item = pl.getListItemByIndex(i);
if (!item) {
// Skip dodgy items.
var pass = item.querySelector("div.password input").value.trim(),
line = `"${record.shownOrigin}","${proto}://${record.shownOrigin}","${user}","${pass}","Submission URL: ${record.url}","from-chrome"`;
document.body.innerText = out.join("\n");
// The line below controls how long the export can run.
}, 5000);
Copy link

whisp8 commented Dec 21, 2017

Uncaught TypeError: PasswordManager.getInstance is not a function
at :2:26

Copy link

I get the same error as @whisp8

Copy link

I have the same error.

Copy link

guruz commented Feb 1, 2018

There is another version at that works in chrome 65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment