If you have ever delved into the Android file system through a file manager or connected smartphone to your computer, you might come across a strange file with the name msgstore.db or msgstore.db.crypt14. It takes up a lot of space (sometimes hundreds of megabytes), but its purpose remains a mystery to most users. What is this file? Why does the system need it? Is it possible to delete it to free up memory? And most importantly, wonโt this harm the operation of the smartphone?
In fact, msgstore.db itโs not an Android system file, but the messenger databases that store your correspondence. Most often it is associated with WhatsApp, but similar files are also created by other applications, for example Telegram or standard SMS storage. In this article we will analyze in detail what is hidden behind this name, how to manage it and what risks are fraught with careless manipulations with such files.
What is msgstore.db and why do you need it?
File msgstore.db is a database in the format SQLite, which stores the history of your messages in instant messengers. Translated from English msgstore means "message storage" (message storage), and the extension .db indicates the database format. This file is created automatically when you install the application and is updated every time you send or receive a new message.
Main tasks msgstore.db:
- ๐ฑ Storing correspondence โ all texts, media files (links to them), reading statuses and time stamps.
- โณ Quick access โ thanks to the SQLite structure, the messenger instantly downloads chat history without contacting servers.
- ๐ Synchronization โ when restoring from a backup, the file is used to recreate the correspondence.
- ๐ Local encryption โ in new versions of WhatsApp the file is encrypted (for example
msgstore.db.crypt14).
It is important to understand that this is not a backup copy in the cloud (like Google Drive or iCloud), and local basethat exists only on your device. If you delete it manually, the correspondence will disappear. irrevocablyif there is no cloud backup.
Where is msgstore.db on Android?
The path to the file depends on the messenger and the version of Android. Below is a list of typical locations:
| Messenger | Path to the file | Notes |
|---|---|---|
/sdcard/WhatsApp/Databases/msgstore.db |
May have an extension .crypt12, .crypt14 or .crypt15 (depending on the encryption version). |
|
| Telegram | /data/data/org.telegram.messenger/databases/* |
Required root access, since it is located in a protected folder. |
| Standard SMS | /data/data/com.android.providers.telephony/databases/mmssms.db |
Stores SMS and MMS. Available only with root or via ADB. |
| Viber | /sdcard/Viber/Media/ i /data/data/com.viber.voip/databases/ |
Database can be named viber_messages or viber_data. |
To see these files, you will need file manager with access to the root folder (for example, Solid Explorer or FX File Explorer) or connecting your smartphone to the PC in MTPmode. Please note: folders /data/data/ are hidden by default and require superuser rights (root).
โ ๏ธ Attention: If you do not see the folderWhatsApp/Databaseson the internal memory, check the messenger settings: backups may be disabled (Settings โ Chat โ Backup). Without backups, the file msgstore.db is not created.
Is it possible to delete msgstore.db to free up memory?
Technically yes, but this will lead to the loss of all local correspondence in the messenger. The file takes up a lot of space because it stores:
- ๐ฌ All text messages (including those deleted by you, but not cleared from base).
- ๐ Media files (photos, videos, voice) - not the files themselves, but links to them and metadata.
- ๐ Information about statuses (read, delivered, time sent).
If you delete msgstore.db:
- WhatsApp/Telegram will not be deleted, but the next time you start it will create a new empty file.
- All chat history disappear (if there is no cloud backup).
- Media files (photos, videos) may remain in the messenger folders, but the link to chats will disappear.
If the memory on the phone is running out, it is better:
โ๏ธ What to do instead of deleting msgstore.db
โ ๏ธ Attention: Whatsapp has a featureClear chats(Settings โ Storagethat deletes media files older than a certain age, but saves text messages. This is safer than manual deletion msgstore.db.
How to open and read the contents of msgstore.db?
File msgstore.db is not an ordinary text document, so you canโt just open it. You will need special tools:
For WhatsApp (without encryption or with the .crypt14 extension)
1. Download the app DB Browser for SQLite (free for Windows/macOS/Linux).
2. If the file has an extension .crypt14, first decrypt it using the utility WhatsApp Key/DB Extractor (requires a key from the folder /data/data/com.whatsapp/files/key, you need root).
3. Open msgstore.db in DB Browser and go to tab Data overview โ table messages.
For Telegram (requires root)
1. Copy the database file from /data/data/org.telegram.messenger/databases/ to your PC.
2. Use SQLiteStudio or DB Browser to view tables messages and media.
In the tables you will find:
- ๐
jidโ chat ID (phone number or group). - ๐ฌ
textโ message text. - โฑ๏ธ
timestampโ time of sending in Unix format. - ๐
statusโ delivery status (0 - sent, 1 - delivered, 2 - read).
Example SQL query for retrieving messages from WhatsApp
SELECT datetime(timestamp/1000, 'unixepoch') as date, jid, text, status
FROM messages
WHERE jid LIKE '%@s.whatsapp.net'
ORDER BY timestamp DESC;
โ ๏ธ Attention: Extracting data from msgstore.db may violate the privacy policy of instant messengers. Do not distribute other people's messages without consent!
How to recover correspondence from msgstore.db?
If you accidentally deleted chats in WhatsApp or Telegram, but the file msgstore.db was preserved, you can try to restore the correspondence. For this:
For WhatsApp:
1. Uninstall WhatsApp and reinstall it.
2. When you first start, enter your phone number and wait for the request to restore from a backup.
3. The system will automatically find msgstore.db in the folder /WhatsApp/Databases/ and offer to restore chats.
For Telegram:
1. Copy the database file from /data/data/org.telegram.messenger/databases/ to a safe place.
2. Install Telegram with the same phone number.
3. Replace the new database with the old one (requires root).
If the file is damaged, try restoring it using utilities like SQLite Database Recovery or WhatsApp Database Repair Tool.
Before restoring, check the file creation date msgstore.db. If it is older than the last cloud backup, it is better to restore from the cloud so as not to lose new messages.
What to do if msgstore.db is damaged or cannot be restored?
File damage msgstore.db can occur due to:
- ๐ Unexpected power outage during recording.
- ๐ฆ Virus attacks or file system failures.
- ๐ ๏ธ Incorrect manual editing of the database.
Signs of damage:
- WhatsApp/Telegram does not open chats or shows empty dialogs.
- An error appears during recovery
"Unable to restore backup". - The file has zero size or does not open in DB Browser.
Solutions:
- Restore from the cloud (WhatsApp:
Settings โ Chat โ Backup โ Restore). - Use recovery utilities:
- ๐ ๏ธ WhatsApp Database Repair Tool (for
.crypt14). - ๐ ๏ธ SQLite Forensic Explorer (for deep analysis).
- ๐ ๏ธ WhatsApp Database Repair Tool (for
- Extract data manually via DB Browser, if the file is partially opened.
โ ๏ธ Attention: If you use root to restore Telegram, make sure that the messenger version matches the database version. New versions of Telegram may not support old formats msgstore.db.
How to protect msgstore.db from loss or theft?
File msgstore.db contains all your correspondence, including deleted messages and media files. Its theft or leak can lead to compromise of personal data. To secure the file:
โ๏ธ Security measures for msgstore.db
Additional measures:
- ๐ Device encryption - enable in
Settings โ Security โ Encryption(slows down the work, but protects data). - ๐ซ Blocking access to files โ in Android 11+, limit application access to folders via
Settings โ Privacy โ Permission Manager. - ๐ Automatic backup โ set up weekly backups in WhatsApp (
Settings โ Chat โ Backup copying).
If you are selling or transferring a smartphone, it is not enough to simply delete the messenger โ file msgstore.db may remain in memory. To completely erase data:
- Reset to factory settings (
Settings โ System โ Reset). - Use secure erase utilities (for example, SD Maid or CCleaner).
- For security, encrypt the device before resetting.
FAQ: Frequently asked questions about msgstore.db
Can msgstore.db be transferred to another phone?
Yes, but only if:
- Both phones use the same WhatsApp/Telegram number.
- Messenger versions are compatible (for example, msgstore.db.crypt14 will not open in the old version of WhatsApp).
- You will copy the file to the same folder on the new device (
/WhatsApp/Databases/).
After the transfer, reinstall the messenger - it will detect the local database and offer to restore chats.
Why does msgstore.db take up so much space?
The file is growing due to:
- ๐๏ธ Accumulations of old messages (WhatsApp stores correspondence from the moment of installation).
- ๐ธ Media files - even if you deleted photos from the gallery, links to them remain in the database.
- ๐ Multiple backups (WhatsApp creates files
msgstore.db.crypt14-YYYY-MM-DD.1).
To reduce the size:
- Clear old backups in the folder
/WhatsApp/Databases/(leave only the last one). - Use the
Clear chatsfunction in WhatsApp to delete media files.
What happens if you rename msgstore.db?
The messenger will create a new file the next time you start it. The old file will remain on the device as a backup, but:
- โ New messages will not be saved to the renamed one. file.
- โ ๏ธ If you delete the new one msgstore.db and return the old name, the correspondence will be restored, but messages received during the "break" will be lost.
Is it possible to edit msgstore.db to change messages?
Technically yes, but:
- ๐ง This requires DB Browser for SQLite knowledge of the table structure.
- ๐จ WhatsApp/Telegram can block an account for suspicious activity (change
timestamp,jid). - ๐ Changed messages are not synchronized with the cloud and may disappear during the next backup.
Not recommended edit the database without good reason.
Where are msgstore.db stored in iOS?
On the iPhone the file is called differently:
- WhatsApp:
/var/mobile/Applications/[UUID]/Documents/ChatStorage.sqlite(available only through jailbreak or backup iTunes). - Telegram: the data is stored in encrypted form in
Keychain.
For extraction you will need special tools like iExplorer or iMazing.