Migrating from KeePass to 1Password

I’ve been using KeePass for my password management needs since early 2014, but I recently decided that I wanted to move to something a bit more substantial. KeePass is an excellent (open source!) piece of software, but since it stores passwords in a single database file the only way that I could really sync it between multiple computers and my phone was to store that file… in Dropbox.

Yeah, as you can imagine that’s not a great solution.

Anyway, I wanted to move over to 1Password but when I tried searching for “Migrate KeePass to 1Password” I kept seeing references to 3rd party scripts I’d need to use to convert my exported data (no thanks) or that it would require a bunch of manual data entry. After giving it a go though, I can tell you it was actually ridiculously easy and straightforward and didn’t require any external tools or scripts! As such, I decided to put together this step-by-step tutorial for migrating your data from KeePass to 1Password!

Steps

Preparation

  1. Back up your KeePass file

Your passwords are important and whenever you’re doing something like this, first start with a backup! Get a copy of your kdbx file and keep it somewhere safe just in case you run into any problems further in the process.

  1. Clear out old entries that you won’t want later

Now that you have a backup, rather than spending time exporting old entries only to delete them later I definitely recommend cleaning them up in KeePass at this step.

Export from KeePass

  1. Open KeePass and the password file you want to export
  2. Click “File” -> “Export…”
A screenshot of the File menu in KeePass with the "Export" option highlighted
  1. Select “KeePass CSV (1.x) as the format
A screenshot of the Export File/Data window in KeePass with the "KeePass CSV (1.x)" option highlighted
  1. Set “Export to” to the location you want the file saved (use the file selection dialogue by clicking on the floppy disk icon)
  2. Click “OK”

Import into 1Password

  1. Open the the 1Password web interface. I’m not entirely sure why this can’t be done in the desktop application (which only seems to support importing a 1PIF (1Password Interchange Format) file, an Agile Keychain or an OPVault folder), so make sure you open the website!
  2. Click on your profile name in the top right and select “Import”
A screenshot of the 1Password web interface, with the profile dropdown opened and "Import" selected
  1. Choose “KeePassX” (or “Other”, they actually lead to the same page with the same steps and the same issues)
  1. Under “Choose a vault”, select the vault you want to import your data into (in this case, “Test”)
A screenshot of the import process in the 1Password web interface. The current step has a title of "Export your data and add it to 1Password" and there is a dropdown that says "Choose a vault" and a section titled "Upload your CSV file"
  1. Drag and drop the CSV file from the location you chose in step 4 into the window, or use the file selection dialogue
  2. Make sure that the data looks reasonable, like checking that there aren’t multiple elements on one line and that your passwords look as expected; the KeePass export escapes quotes (such as changing a password of abc"123 to abc\"123) which may cause issues. Pay particular note if you see the “Review your items carefully” notification, which may indicate a problem in the import! Details on how to resolve these issues can be found in the Fixing Data Import Issues section
A screenshot of the 1Password import process, specifically a notification that says "Review your items carefully - There may have been some problems importing your information. Need Help? Contact Support."
A screenshot of the import process in the 1Password web interface. The current step shows a preview of the data to be imported and has a series of checkboxes down the left side specifying what kind of item they are (in this case, all "Login" items)
  1. Change the top line from “Login” to “Ignore Row” (this is the automatically included header line exported from KeePass that 1Password would otherwise try and import as a separate item)
A screenshot of the import process in the 1Password web interface. The preview of the data import has the top line (with header elements such as "Account" and "Login Name") has been set to "Ignore Row" instead of "Login"
  1. Click “Continue”
  2. Set the labels for each data item. By default my version of KeePass exported the data in the following order, but look at what makes sense for your data:
    1. Title
    2. Username
    3. Password
    4. URL
    5. Notes
A screenshot of the import process in the 1Password web interface. The current step shows a preview of the data to be imported and has the data fields specified for each column
  1. Click “Import”
A screenshot of the import process in the 1Password web interface. The current step has a heading of "Import Successful!" and says "5 items were added to the Test vault. Make sure you delete the unencrypted CSV file."
  1. Click “Show imported items”
A screenshot of the 1Password web interface. The current screen shows the "Test" vault, which has five Login items associated with it

Final Steps

Your data should now be imported! There are a few things that are worth doing before you consider the process complete though:

  1. As the final step in the import process says, this is a good time to permanently delete the unencrypted CSV file that you generated!
  2. Save a final copy of your KeePass kdbx file in a safe location. Although you’ve imported all of your logins into 1Password, you won’t have access to any of the password histories that were stored in KeePass. It’s best to keep a copy available just in the (hopefully unlikely) situation that you need an older password or want to see what changed on that entry over time.
  3. If you had to clean up any of the data in the original CSV file (using the steps in the “Fixing Import Data Issues” section), now is a good time to fix any badly quoted text or escaped quotations. Go through any of the items that you modified and fix the notes!

And now you’re done. Enjoy 1Password!

Fixing Data Import Issues

The CSV export from KeePass escapes quotation marks (converting " to \") and the 1Password import process doesn’t always handle this very nicely. This presents itself in a couple of ways:

Broken Logins

One of the scarier issues you might run into is finding that your passwords appear to be wrong when logging into services using the details stored in 1Password. This most likely points to a situation where your original password contained a quote (for example abc"123) which was then escaped by the KeePass export process (converting the above example to abc\"123), leading to issues logging in since the password is no longer correct.

The fastest way to resolve if you have already started using 1Password or the number of affected items is low is to update any failing entries in 1Password itself by checking the password text and switching any instance of \" to " (removing the backslash).

If you’ve only just migrated to 1Password or believe that this issue might affect a large number of different entries you can fix the initial data set and re-do the import. This will require going through the CSV file exported from KeePass and manually updating any passwords similar to above, switching any instance of \" to " (NOTE: Don’t use find and replace! This could inadvertently break situations where quotes have correctly been escaped such as in notes).

Multiple Entries on One Line in Import Data Preview

You may see instances of multiple logins appearing on one line during step 6 of the import process (the import data preview).

A screenshot of the import process in the 1Password web interface. The preview of the data to import has one line that extends further than the others because it includes the data of two different logins, one after the other

In this particular case, the issue was related to the Comments field I was using in KeePass to test the export process:

This is an example of a longer comment with more detail. I'm going to keep writing things and show that they are all migrated automatically without issue.

I can even use newlines without a problem since they're persisted across!
"I can use quotes as well since they are correctly escaped"

Yes, the hubris of writing that and then finding out it didn’t work properly was not lost on me.

In the exported CSV, KeePass generates the following:

"Service1","Username1","Password1","","This is an example of a longer comment with more detail. I'm going to keep writing things and show that they are all migrated automatically without issue.

I can even use newlines without a problem since they're persisted across!
\"I can use quotes as well since they are correctly escaped\""
"Service2","Username2","Password2","",""

I’m not entirely sure why, but it seems that 1Password has issues with the escaped quotes near the end of line 6 and considers the following line (line 7) as additional elements to the same login. You can see the problem a bit clearer in the import data preview:

Thankfully, this can be fixed by removing the final quote on line 6 so that the data looks as follows:

"Service1","Username1","Password1","","This is an example of a longer comment with more detail. I'm going to keep writing things and show that they are all migrated automatically without issue.

I can even use newlines without a problem since they're persisted across!
\"I can use quotes as well since they are correctly escaped\"
"Service2","Username2","Password2","",""

Your exact mileage may vary with this approach, but hopefully it’ll point you in the right direction for resolving this issue!

7 thoughts on “Migrating from KeePass to 1Password

  1. Hi, thanks for the help on this Matthew. It looks like an update is in 1Password that KeePassX is an option. You no loner have to select “other”

    Like

    1. I finally got around to giving this a go so that I could update the post with the new details, but it turns out that the “KeePassX” option is identical to selecting the “Other” option; they both load the same CSV importer! I’ve taken this opportunity to make a few tweaks to the content to include this new option and cover a couple of extra edge-cases though, so thanks for the comment letting me know about it!

      Like

  2. Thanks Matt, your tutorial was easy to understand and very helpful. took me about 5 minutes to migrate my passwords.

    Like

  3. I’m trying this as well, the only issue is, that I also use attachments and string fields ( for those Recovery questions ). I have no idea how this translate to 1password, anyone has any advice?

    Like

  4. I am migrating from Lenovo/Windows to Apple, and this is the reason why I am migrating from KeePass to 1Password.

    In my first attempt I followed the instructions above and it did not work. I copied the csv-file from my Windows laptp to the Mac. The csv-File looks different on the Mac and 1Password is not able to import it properly.

    In my second attempt I opend the 1Password webinterface on the Windows laptop and it worked as designed.

    Thank you very much, this saved me a lot of manual work!

    Like

  5. So, how does 1Password compare to the likes of Dashlane Premium? I have used Dashlane for some years but its a pricey solution especially if you want the whole family involved.

    Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.