Skip to content
Switch branches/tags
Go to file

Latest commit


Failed to load latest commit information.
Latest commit message
Commit time

Dump WeChat Messages from Android


WeChat, as the most popular mobile IM app in China, doesn't provide any options to export structured message history. This tool can decrypt and parse WeChat messages on a rooted android phone, and dump messages into self-contained html files including voice messages, images, emojis, videos, etc.

If the tool works for you, please take a moment to add your phone/OS to the wiki.

How to use:


  • adb and rooted android phone connected to a Linux/Mac OSX/Win10+Bash. If the phone does not come with adb support, you can download an app such as
  • Python >= 3.6
  • sqlcipher >= 4.1
  • sox (command line tools)
  • Silk audio decoder (included; build it with ./third-party/
  • Other python dependencies: pip install -r requirements.txt.

Get Necessary Data:

  1. Pull database file and (for older wechat versions) avatar index:
  • Automatic: ./ db. It may use an incorrect userid.
  • Manual:
    • Figure out your ${userid} by inspecting the contents of /data/data/ on the root filesystem of the device. It should be a 32-character-long name consisting of hexadecimal digits.
    • Get /data/data/${userid}/EnMicroMsg.db from the device.
  1. Decrypt database file:
  • Automatic: ./ decrypt --input EnMicroMsg.db
  • Manual:
    • Get WeChat uin (an integer), possible ways are:

      • ./ uin, which looks for uin in /data/data/
      • Login to web wechat, get wxuin=1234567 from document.cookie
    • Get your device id (a positive integer), possible ways are:

      • ./ imei implements some ways to find device id.
      • Call *#06# on your phone
      • Find IMEI in system settings
    • Decrypt database with combination of uin and device id:

      ./ decrypt --input EnMicroMsg.db --imei <device id> --uin <uin>

      NOTE: you may need to try different ways to get device id and find one that can decrypt the database. Some phones may have multiple IMEIs, you may need to try them all. See #33. The command will dump decrypted database at EnMicroMsg.db.decrypted.

If decryption doesn't work, you can also try the password cracker to brute-force the password.

  1. Copy the WeChat user resource directory /mnt/sdcard/tencent/MicroMsg/${userid}/{avatar,emoji,image2,sfs,video,voice2} from the phone to the resource directory:

    • ./ res
    • Change RES_DIR in the script if the location of these directories is different on your phone.
    • This can take a while. Can be faster to first archive it with tar with or without compression, and then copy the archive, busybox tar is recommended as the Android system's tar may choke on long paths.
    • In the end, we need a resource directory with the following subdir: avatar,emoji,image2,sfs,video,voice2.
  2. (Optional) Download the emoji cache from here and decompress it under wechat-dump. This will avoid downloading too many emojis during rendering.

     wget -c
     tar xf emoji.cache.tar.bz2


  • Parse and dump text messages of every chat (requires decrypted database):

    ./ decrypted.db output_dir
  • List all chats (required decrypted database):

    ./ decrypted.db
  • Generate statistics report on text messages (requires output_dir from ./

    ./ output_dir
  • Dump messages of one contact to html, containing voice messages, emojis, and images (requires decrypted database and resource):

    ./ "<contact_display_name>"

    The output file is output.html.

    Check ./ -h to use different paths.


Screenshots of generated html:


See here for an example html.


  • Fix rare unhandled message types: > 10000 and < 0
  • Better user experiences... see grep 'TODO' wechat -R




Cracking encrypted wechat message history from android





No packages published