Info below is current as of December 2021. Please read the whole guide before performing any steps.
This is a guide to migrating whatsapp messages from Android to iOS using open source software for free.
Currently no official method exists for migrating historical messages in whatsapp when moving from an android to ios device.
There is an official method for migrating from iOS to Samsung android phones using Samsung's SmartSwitch utility. Android > iOS is apparently a work in progress for the WhatsApp team but there is no ETA provided.
3rd party utilities exist to migrate WhatsApp messages from Android to iOS such as Dr. Fone, MobileTrans, Mobitrix, BackupTrans however these are all paid solutions, closed source, and have ambiguous privacy policies that mean these tools cannot be trusted that they are not exporting whole copies of your messages.
The steps below go through getting the decrypted message database from an android device through backing up an iPhone locally, modifying the whatsapp backup and restoring the backup to the iOS device.
- Activating whatsapp on a new device will prevent viewing any messages on a previous device
- Currently, only messages are transferred. Media files received a replaced by placeholder
<Image>
message - Historical messages in groups chats will appear immediately on transfer by clicking on the group, historical messages from individuals will not appear as conversations on the homepage until you send/receive a message to/from that person. Messages from individuals can be always found by search.
- Performing the below steps will erase and restore the iphone, it is best to do this early on in the setup process of your new device.
- adb tools or full Android studio - adb tools should be added to path
- allow USB debug access from android device
- watoi
- python3
- Access to macOS with xcode installed (Genuine mac or virtual machine)
The message database is user accessible on android but encrypted with AES-256. The encryption key for WhatsApp is stored with in a protected portion on the android device. This key is created at install and is calculated based on your phone number (therefore does not change between installations).
a. If your android device is rooted, connect to pc and run the following
mkdir WhatsApp-Migration
cd WhatsApp-Migration
adb root
adb pull /sdcard/Android/media/com.WhatsApp/WhatsApp/Databases/msgstore.db.crypt14
adb pull /data/data/com.WhatsApp/files/key
adb pull /data/data/com.WhatsApp/databases/wa.db
b. If your Android device is not rooted (method 1 - using old WhatsApp APK)
try this guide here, however i did not have any success with it
c. If your Android device is not rooted (method 2 - Using Android Emulator)
- Backup WhatApp on your android device to Google drive
- Install android studio
- download the WhatsApp APK (any version)
- In android studio - Tools > AVD Manager
- Create an android virtual device (AVD)
- Start the AVD
- Install WhatsApp APK (drag and drop the APK file onto the virtual device)
- install and activate WhatsApp on the AVD
- restore from the Google drive backup
- Once restored, connect with adb as per root instructions above and retrieve the db and key (The virtual device will have root access)
Perform from within the same directory as your msgstore.db.crypt14 and key.
pip install pycrypto pycryptodome
git clone https://github.com/ElDavoo/WhatsApp-Crypt14-Decrypter
python3 ./WhatsApp-Crypt14-Decrypter/decrypt14.py key msgstore.db.crypt14 msgstore.db
rm -rf WhatsApp-Crypt14-Decrypter
mkdir original-files
mv msgstore.db.crypt14 original-files
mv wa.db original-files
mv key original-files
Recent versions of iTunes don't have an option for local backup. Either install an older version of iTunes or use the Apple Configurator 2 App to backup. Backups can be created on macOS or windows with iTunes but all further steps need to be done on macOS.
- Install WhatsApp from the Appstore and activate WhatsApp
- Create a local backup with itunes/or Apple Configurator 2
- If using windows: copy the contents of
%APPDATA%\Apple Computer\MobileSync\Backup
to/Users/tim/Library/Application\ Support/MobileSync/Backup
on macOS - Make a backup of the backup files and get the Backup ID (folder name within Backup directory)
git clone https://github.com/residentsummer/watoi
watoi/scripts/bedit.sh list-backups
export BACKUP_ID="put ID of the backup here" # use the latest ID from the list-backups command
cp -R ~/Library/Application\ Support/MobileSync/Backup/$(BACKUP_ID) original-backup
You will need a copy of WhatsApp.ipa of same version you have on your device. You can get this from the internet or following this guide to obtain via the apple configuratior.
- Update WhatsApp on the iPhone
- Install and open Apple Configurator 2 (AC2)
- Connect your phone
- Right click on the phone in the AC2 window and click add > apps > WhatsApp
- When prompted that WhatsApp already exists don't click anything and open finder
- Copy the ipa file from
~/Library/Group Containers/K36BKF7T3D.group.com.apple.configurator/Library/Caches/Assets/TemporaryItems/MobileApps/
to your working directory - Cancel the previous prompts and close AC2
unzip ./Whatsapp.ipa -d app
The commands below extract the message files from the backup and important manifest files.
export ORIGINALS="originals/$(date +%s)"
mkdir -p $ORIGINALS
watoi/scripts/bedit.sh extract-chats $BACKUP_ID $ORIGINALS/ChatStorage.sqlite
watoi/scripts/bedit.sh extract-blob $BACKUP_ID Manifest.db $ORIGINALS/Manifest.db
cp $ORIGINALS/ChatStorage.sqlite ./ChatStorage.sqlite
xcodebuild -project watoi/watoi.xcodeproj -target watoi
watoi/build/Release/watoi msgstore.db ./ChatStorage.sqlite app/Payload/WhatsApp.app/Frameworks/Core.framework/WhatsAppChat.momd
scripts/bedit.sh replace-chats $BACKUP_ID ./ChatStorage.sqlite
Restore the backup with iTunes/Apple Configurator 2.
If you have issues restoring on macOS (I had issued with Apple Configurator stating my device was already provisioned then not detecting the device after factory restore) the backup files can be copied to windows and restored via iTunes.
Browse your msgstore.db file on your pc with whatsapp-viewer if you need to view these at a later date or just have no success in patching the iPhone backup and just want a way to see the messages.
Using the wa.db file will show contact names along with the messages.
This guide uses the fantastic tools:
- https://github.com/residentsummer/watoi
- https://github.com/ElDavoo/WhatsApp-Crypt14-Decrypter
- https://github.com/andreas-mausch/whatsapp-viewer
Also was inspired by these guides:
- https://github.com/tim25651/WhatsApp2iOS
- https://gist.github.com/proxium/ee76c9a599a55e6d50b31e8159f66b39
- https://dev.to/tranthanhvu/how-to-download-ipa-file-from-appstore-37im
I had also tried these tools but could not get them to work - your milage may vary:
- private android whatsapp data -
data/data/com.whatsapp/files/key
- android whatsapp data -
/sdcard/Android/media/com.whatsapp/
- windows iTunes backup path -
%APPDATA%\Apple Computer\MobileSync\Backup
- mac apple configurator 2 backup path -
~/Library/Group Containers/K36BKF7T3D.group.com.apple.configurator/Library/Caches/Assets/TemporaryItems/MobileApps/
All of the above steps are at your own risk. This is a fiddly process and took me many attempts. Make sure you make backups along the way, i take no responsibility if you lose data performing any of these steps.
This guide is provided under the GPLv3 License.
All tools used are provided under their own license terms check the project pages for details.
Copyright (C) 2021 needs-coffee
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.