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!
- 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.
- 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
- Open KeePass and the password file you want to export
- Click “File” -> “Export…”
- Select “KeePass CSV (1.x) as the format
- Set “Export to” to the location you want the file saved (use the file selection dialogue by clicking on the floppy disk icon)
- Click “OK”
Import into 1Password
- 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!
- Click on your profile name in the top right and select “Import”
- Choose “Other”
- Under “Choose a vault”, select the vault you want to import your data into (in this case, “Test”)
- Drag and drop the CSV file from the location you chose in step 4 into the window, or use the file selection dialogue
- Make sure that the data looks reasonable, like checking that there aren’t multiple elements on one line (if there are, see the section later in this post titled “Fixing Data Import Issues”)
- 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)
- Click “Continue”
- 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:
- Click “Import”
- Click “Show imported items”
Your data should now be imported! There are a few things that are worth doing before you consider the process complete though:
- As the final step in the import process says, this is a good time to permanently delete the unencrypted CSV file that you generated!
- 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.
- 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
\") and the 1Password import process doesn’t always handle this very nicely.
As an example, I had a note with the following text in one of my logins:
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, this 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","",""