File format · .kdbx
KDBX File Format and Repair: KeePass 2.x Password Databases
How the KDBX format works, why KeePass 2.x databases fail to open, and what professional repair can recover from a damaged password vault.
A .kdbx file is an encrypted password database created by KeePass 2.x, the free, open-source password manager developed by Dominik Reichl. One file holds your entire credential vault: logins, secure notes, and attachments. When it refuses to open, you lose access to all of it at once. A damaged vault can usually be recovered, provided you still hold the master password and, where used, the key file. This page covers the format's structure, the causes of damage, and what careful repair can bring back.
What is a KDBX file?
KDBX is the database format KeePass 2.x introduced to replace the KDB format of the 1.x generation. A single file stores the whole vault as an encrypted XML document. Dominik Reichl develops KeePass as open-source software, and the official KeePass help center is the authoritative reference for the specification.
The format spread well beyond its original application. KeePassXC, KeePassDX, Strongbox, KeePassium, and KeeWeb all read and write KDBX files, and many browser extensions import from them. Compatibility depends on the version. KDBX 3.1 has the widest third-party support. KDBX 4 arrived with KeePass 2.35 in 2017 and added Argon2 key derivation and ChaCha20.
Inside the format: header, ciphers, and XML
The file has two layers. An outer header sits in the clear, and everything after it is encrypted.
The file opens with an 8-byte signature. Its first four bytes, 03 D9 A2 9A, are shared with the older KDB format; the second four separate the two families. A 4-byte little-endian version number follows: 0x00030001 for KDBX 3.1, 0x00040000 for 4.0, and 0x00040001 for 4.1. Reading this version is always the first step in any repair, because it dictates everything that comes next.
After the signature, the header declares the cipher, the compression setting, and fresh random material for that save. AES-256 in CBC mode is the default. KDBX 4 also offers ChaCha20, and a plugin adds Twofish. Key derivation settings sit here too: the classic AES-KDF iteration count, or the Argon2 parameters (memory, iterations, parallelism) introduced in version 4.
Your credentials never appear in the file. Instead, a composite key is computed from what you supply at unlock: the master password, an optional key file, and, in older databases, the Windows account. The header's random seed feeds that computation. If the header is lost, the correct password stops working, and that fact drives every repair decision.
After the header comes the encrypted payload. KDBX 3.1 encrypts it as one stream guarded by SHA-256 digests. KDBX 4 splits it into blocks, each protected by its own HMAC-SHA256 tag, so truncation and tampering are detected block by block. Decrypting the payload reveals a small inner header with stream cipher settings and attachments, then the XML itself: groups, entries, custom fields, timestamps, and per-entry history. Sensitive values such as passwords are masked again with a stream cipher, Salsa20 in 3.1 and ChaCha20 in 4.
How does a KDBX database become corrupt?
Interrupted saves are the classic trigger. KeePass writes defensively: it builds a temporary file, then swaps it into place, and it can keep the previous version as a .old backup beside the database. A power cut at the wrong instant can still defeat that sequence and leave an empty, zero-byte file or a half-written one.
Storage and transfer faults do their share. Bad sectors, failing flash memory, and interrupted downloads truncate or scramble the ciphertext. Because almost everything is encrypted, a handful of flipped bytes can invalidate a digest or an entire block.
Sync conflicts are a leading cause in practice. File-level synchronization through services such as Dropbox, OneDrive, or Google Drive breaks when two devices save before syncing. The service may keep a conflicting copy, overwrite the newer file, or upload something incomplete. The developer warns about this and provides a built-in Synchronize command that merges changes instead, which is the safer route.
External damage rounds out the list. Ransomware encrypts or wipes KDBX files along with everything else. Older third-party apps that predate KDBX 4 can also write files that newer software refuses to open.
Symptoms of a damaged database
KeePass reports damage through a small set of messages. "The composite key is invalid," shown for a password you know is right, usually points to a damaged header rather than a forgotten password. "Unrecognized file signature" or an invalid header means the first bytes are gone. "Unsupported file version" typically means the app predates KDBX 4. A crash on open or a zero-byte file signals deeper structural loss.
What can be recovered from a damaged KDBX file?
With the correct master password and key file, a great deal: the group tree, titles, usernames, passwords, URLs, notes, custom fields, attachments, and entry history. If the file was truncated, entries stored earlier in the XML usually survive while the tail is lost.
Header damage is the hard case. The master seed and IV feed key derivation, so if those bytes are destroyed, the right password still cannot unlock the body. An engineer can sometimes rebuild the header from an older .old backup, a cloud version, or another copy. Without any source for that seed, the payload stays ciphertext.
Without the master password, no repair technique helps. There is no backdoor in AES or Argon2. A vault protected by a strong passphrase cannot be decrypted by any service, ours included.
What should you gather before requesting a repair?
Encryption is the whole point of this format, so recovery works with your key, never around it. Collect three things before sending the file anywhere:
- The master password, exactly as typed. It becomes part of the composite key, and a near miss unlocks nothing.
- The key file, if one is used. Without it, the password alone cannot derive the key.
- Every backup copy you can find: the .old file, a cloud version, an earlier export. Any of these can supply header material or an intact body.
These three items decide whether the damage is a repair problem or a permanent loss. We ask for them during every evaluation, and we explain the odds honestly before work starts.
How does professional KDBX recovery work?
Our process never writes to the damaged original; every step runs on a copy. It has four stages.
- Evaluation. We parse the header, confirm the version and cipher, and test key derivation against the password you supply. This locates the damage in the header, the payload, or both, and it sets a fixed price before work begins.
- Reconstruction. Where a source exists, such as a backup or cloud copy, we rebuild the missing header fields so key derivation can succeed.
- Extraction. We verify block HMACs in KDBX 4 files, salvage every decryptable block, and repair the XML that emerges.
- Delivery. Recovered entries are imported into a fresh database, checked against your expectations, and returned as a working KDBX file plus a plain XML or CSV export.
We confirm that attachments open and protected fields decrypt before anything leaves our hands. The export lets the vault move to any compatible application, not just KeePass.
Keeping the next database safe
Close the database before a file-sync service runs, or use the Synchronize command built into KeePass so changes merge rather than overwrite. Leave automatic .old backups enabled, and copy them together with the key file to a second location on a schedule. Cloud drives keep their own version history, which has rescued many vaults after a bad sync. Store the master password somewhere a trusted person could find it in an emergency. A vault no one can ever lose access to is also a vault no one can recover.
Frequently asked questions
Can a KDBX file be opened without the master password?
No. The contents use strong encryption, and Argon2 derivation in KDBX 4 is deliberately expensive to attack. If the password is lost, the only path is guessing it. Treat any service promising a bypass with suspicion.
What is the difference between KDB and KDBX?
KDB is the KeePass 1.x format; KDBX is the 2.x format described here. The signature bytes differ, and KDBX stores far more: custom fields, history, icons, attachments, and a choice of ciphers. KeePass 2.x can import older KDB databases.
Send us your .kdbx file for a free evaluation
Our recovery engineers will tell you exactly what can be recovered — at no cost. There is no charge if we cannot recover your data.
Start a free evaluation