Skip to main content

Whatsapp-Chat-Exporter

Latest in PyPI License MIT Python Matrix Chat Room Since 2021

A customizable Android and iOS/iPadOS Whatsapp database parser that will give you the history of your Whatsapp conversations in HTML and JSON. Inspired by Telegram Chat Export Tool.

If you would like to support this project, all you need to do is to contribute or share this project! If you think otherwise and want to make a donation, please refer to the Donation Guide.

To contribute, see the Contributing Guidelines.

Usage

First, install the exporter by:

pip install whatsapp-chat-exporter
pip install whatsapp-chat-exporter[android_backup]  :; # Optional, if you want it to support decrypting Android WhatsApp backup.

Then, create a working directory in somewhere you want

mkdir working_wts
cd working_wts

Working with Android

Unencrypted WhatsApp database

Extract the WhatsApp database with whatever means, one possible means is to use the WhatsApp-Key-DB-Extractor. Note that the extractor only works on Android 4.0 to 13.

After you obtain your WhatsApp database, copy the WhatsApp database and media folder to the working directory. The database is called msgstore.db. If you also want the name of your contacts, get the contact database, which is called wa.db. And copy the WhatsApp (Media) directory from your phone directly.

And now, you should have something like this in the working directory.

Android folder structure

Extracting

Simply invoke the following command from shell.

wtsexporter -a

Enriching Contact from vCard

The default WhatsApp contact database typically contained contact names extracted from your phone, which the exporter used to map your chats. However, in some reported cases, the database may have never been populated. In such case, you can export your contacts to a vCard file from your phone or a cloud provider like Google Contacts. Then, install the necessary dependency and run the following command from the shell:

pip install whatsapp-chat-exporter["vcards"]
wtsexporter -a --enrich-from-vcards contacts.vcf --default-country-code 852

Encrypted Android WhatsApp Backup

In order to support the decryption, install pycryptodome if it is not installed

pip install pycryptodome # Or 
pip install whatsapp-chat-exporter["android_backup"] # install along with this software

Crypt12 or Crypt14

You will need the decryption key file from your phone. If you have root access, you can find it as /data/data/com.whatsapp/files/key. Otherwise, if you used WhatsApp-Key-DB-Extractor before, it will appear in the WhatsApp backup directory as WhatsApp/Databases/.nomedia.

Place the decryption key file (key) and the encrypted WhatsApp Backup (msgstore.db.crypt14) in the working directory. If you also want the name of your contacts, get the contact database, which is called wa.db. And copy the WhatsApp (Media) directory from your phone directly.

And now, you should have something like this in the working directory.

Android folder structure with WhatsApp Backup

Extracting

Simply invoke the following command from shell.

wtsexporter -a -k key -b msgstore.db.crypt14

Crypt15 (End-to-End Encrypted Backup)

To support Crypt15 backup, install javaobj-py3 if it is not installed

pip install javaobj-py3 # Or 
pip install whatsapp-chat-exporter["crypt15"] # install along with this software

Before proceeding with this method, you must first create an end-to-end encrypted backup. For detailed instructions, refer to WhatsApp's help center.

Once you have copied the backup files to your computer, place the encrypted WhatsApp backup file (msgstore.db.crypt15) into the working directory. If you also wish to include your contacts' names, obtain the contact database file, named wa.db. Additionally, copy the WhatsApp Media folder directly from your phone.

If you do not have the 32 bytes hex key (64 hexdigits), place the decryption key file (encrypted_backup.key) extracted from Android. If you gave the 32 bytes hex key, simply put the key in the shell.

Now, you should have something like this in the working directory (if you do not have 32 bytes hex key).

Android folder structure with WhatsApp Crypt15 Backup

Extracting

If you do not have 32 bytes hex key but have the key file available, simply invoke the following command from shell.

wtsexporter -a -k encrypted_backup.key -b msgstore.db.crypt15

If you have the 32 bytes hex key, simply put the hex key in the -k option and invoke the command from shell like this:

wtsexporter -a -k 133735053b5204b08e5c3823423399aa30ff061435ab89bc4e6713969cda1337 -b msgstore.db.crypt15

Working with iOS/iPadOS (iPhone or iPad)

Do an iPhone/iPad Backup with iTunes/Finder first.

Encrypted iOS/iPadOS Backup

If you want to work on an encrypted iOS/iPadOS Backup, you should install iphone_backup_decrypt from KnugiHK/iphone_backup_decrypt before you run the ios_media_handler.py.

pip install git+https://github.com/KnugiHK/iphone_backup_decrypt

Extracting

To extract messages from iOS/iPadOS backups, run the following command in the shell, making sure to replace the username and device ID with the correct values. Keep in mind that there are at least two possible paths for the backups on Windows.

Windows

# Possible path one
wtsexporter -i -b "C:\Users\[Username]\AppData\Roaming\Apple Computer\MobileSync\Backup\[device id]"

# Possible path two
wtsexporter -i -b "C:\Users\[Username]\Apple\MobileSync\Backup\[device id]"

Mac

wtsexporter -i -b ~/Library/Application\ Support/MobileSync/Backup/[device id]

Results

After extracting, you will get this:

Private Message

Working with Business

If you are working with WhatsApp Business, add the --business flag to the command

wtsexporter -a --business ...other flags
wtsexporter -i --business ...other flags

More options

Invoke the wtsexporter with --help option will show you all options available.

> wtsexporter --help
usage: wtsexporter [-h] [--debug] [-a] [-i] [-e EXPORTED] [-w WA] [-m MEDIA] [-b BACKUP] [-d DB]
                   [-k [KEY]] [--call-db [CALL_DB_IOS]] [--wab WAB] [-o OUTPUT] [-j [JSON]]
                   [--txt [TEXT_FORMAT]] [--no-html] [--size [SIZE]] [--no-reply] [--avoid-encoding-json]
                   [--pretty-print-json [PRETTY_PRINT_JSON]] [--tg] [--per-chat] [--import] [-t TEMPLATE]
                   [--offline OFFLINE] [--no-avatar] [--old-theme] [--headline HEADLINE] [-c]
                   [--create-separated-media] [--time-offset {-12 to 14}] [--date DATE]
                   [--date-format FORMAT] [--include [phone number ...]] [--exclude [phone number ...]]
                   [--dont-filter-empty] [--enrich-from-vcards ENRICH_FROM_VCARDS]
                   [--default-country-code DEFAULT_COUNTRY_CODE] [--incremental-merge]
                   [--source-dir SOURCE_DIR] [--target-dir TARGET_DIR] [-s] [--check-update]
                   [--check-update-pre] [--assume-first-as-me] [--business]
                   [--decrypt-chunk-size DECRYPT_CHUNK_SIZE]
                   [--max-bruteforce-worker MAX_BRUTEFORCE_WORKER] [--no-banner] [--fix-dot-files]

A customizable Android and iOS/iPadOS WhatsApp database parser that will give you the history of your
WhatsApp conversations in HTML and JSON. Android Backup Crypt12, Crypt14 and Crypt15 supported.

options:
  -h, --help            show this help message and exit
  --debug               Enable debug mode

Device Type:
  -a, --android         Define the target as Android
  -i, --ios             Define the target as iPhone/iPad
  -e, --exported EXPORTED
                        Define the target as exported chat file and specify the path to the file

Input Files:
  -w, --wa WA           Path to contact database (default: wa.db/ContactsV2.sqlite)
  -m, --media MEDIA     Path to WhatsApp media folder (default: WhatsApp)
  -b, --backup BACKUP   Path to Android (must be used together with -k)/iOS WhatsApp backup
  -d, --db DB           Path to database file (default:
                        msgstore.db/7c7fba66680ef796b916b067077cc246adacf01d)
  -k, --key [KEY]       Path to key file. If this option is set for crypt15 backup but nothing is
                        specified, you will be prompted to enter the key.
  --call-db [CALL_DB_IOS]
                        Path to call database (default: 1b432994e958845fffe8e2f190f26d1511534088) iOS only
  --wab, --wa-backup WAB
                        Path to contact database in crypt15 format

Output Options:
  -o, --output OUTPUT   Output to specific directory (default: result)
  -j, --json [JSON]     Save the result to a single JSON file (default if present: result.json)
  --txt [TEXT_FORMAT]   Export chats in text format similar to what WhatsApp officially provided (default
                        if present: result/)
  --no-html             Do not output html files
  --size, --output-size, --split [SIZE]
                        Maximum (rough) size of a single output file in bytes, 0 for auto
  --no-reply            Do not process replies (iOS only) (default: handle replies)

JSON Options:
  --avoid-encoding-json
                        Don't encode non-ascii characters in the output JSON files
  --pretty-print-json [PRETTY_PRINT_JSON]
                        Pretty print the output JSON.
  --tg, --telegram      Output the JSON in a format compatible with Telegram export (implies json-per-
                        chat)
  --per-chat            Output the JSON file per chat
  --import              Import JSON file and convert to HTML output

HTML Options:
  -t, --template TEMPLATE
                        Path to custom HTML template
  --offline OFFLINE     Relative path to offline static files
  --no-avatar           Do not render avatar in HTML output
  --old-theme           Use the old Telegram-alike theme
  --headline HEADLINE   The custom headline for the HTML output. Use '??' as a placeholder for the chat
                        name

Media Handling:
  -c, --move-media      Move the media directory to output directory if the flag is set, otherwise copy it
  --create-separated-media
                        Create a copy of the media seperated per chat in <MEDIA>/separated/ directory

Filtering Options:
  --time-offset {-12 to 14}
                        Offset in hours (-12 to 14) for time displayed in the output
  --date DATE           The date filter in specific format (inclusive)
  --date-format FORMAT  The date format for the date filter
  --include [phone number ...]
                        Include chats that match the supplied phone number
  --exclude [phone number ...]
                        Exclude chats that match the supplied phone number
  --dont-filter-empty   By default, the exporter will not render chats with no valid message. Setting this
                        flag will cause the exporter to render those. This is useful if chat(s) are
                        missing from the output

Contact Enrichment:
  --enrich-from-vcards ENRICH_FROM_VCARDS
                        Path to an exported vcf file from Google contacts export. Add names missing from
                        WhatsApp's default database
  --default-country-code DEFAULT_COUNTRY_CODE
                        Use with --enrich-from-vcards. When numbers in the vcf file does not have a
                        country code, this will be used. 1 is for US, 66 for Thailand etc. Most likely use
                        the number of your own country

Incremental Merging:
  --incremental-merge   Performs an incremental merge of two exports. Requires setting both --source-dir
                        and --target-dir. The chats (JSON files only) and media from the source directory
                        will be merged into the target directory. No chat messages or media will be
                        deleted from the target directory; only new chat messages and media will be added
                        to it. This enables chat messages and media to be deleted from the device to free
                        up space, while ensuring they are preserved in the exported backups.
  --source-dir SOURCE_DIR
                        Sets the source directory. Used for performing incremental merges.
  --target-dir TARGET_DIR
                        Sets the target directory. Used for performing incremental merges.

Miscellaneous:
  -s, --showkey         Show the HEX key used to decrypt the database
  --check-update        Check for updates (require Internet access)
  --check-update-pre    Check for updates including pre-releases (require Internet access)
  --assume-first-as-me  Assume the first message in a chat as sent by me (must be used together with -e)
  --business            Use Whatsapp Business default files (iOS only)
  --decrypt-chunk-size DECRYPT_CHUNK_SIZE
                        Specify the chunk size for decrypting iOS backup, which may affect the decryption
                        speed.
  --max-bruteforce-worker MAX_BRUTEFORCE_WORKER
                        Specify the maximum number of worker for bruteforce decryption.
  --no-banner           Do not show the banner
  --fix-dot-files       Fix files with a dot at the end of their name (allowing the outputs be stored in
                        FAT filesystems)

WhatsApp Chat Exporter: 0.13.1 Licensed with MIT. See https://wts.knugi.dev/docs?dest=osl for all open
source licenses.

Verifying Build Integrity

To ensure that the binaries provided in the releases were built directly from this source code via GitHub Actions and have not been tampered with, GitHub Artifact Attestations is used. You can verify the authenticity of any pre-built binaries using the GitHub CLI.

Using Bash (Linux/WSL/macOS)

for file in wtsexporter*; do gh attestation verify "$file" -R KnugiHK/WhatsApp-Chat-Exporter; done

Using PowerShell (Windows)

gci "wtsexporter*" | % { gh attestation verify $_.FullName -R KnugiHK/WhatsApp-Chat-Exporter }

Python Support Policy

This project officially supports all non-EOL (End-of-Life) versions of Python. Once a Python version reaches EOL, it is dropped in the next release. See Python's EOL Schedule.

Legal Stuff & Disclaimer

This is a MIT licensed project.

The Telegram Desktop's export is the reference for whatsapp.html in this repo.

bplist.py was released by Vladimir "Farcaller" Pouzanov under MIT license.

Please also refer to any files prefixed with LICENSE to obtain copies of the various licenses.

WhatsApp Chat Exporter is not affiliated, associated, authorized, endorsed by, or in any way officially connected with the WhatsApp LLC, or any of its subsidiaries or its affiliates. The official WhatsApp LLC website can be found at https://www.whatsapp.com/.

Metadata

Release files for whatsapp-chat-exporter 0.13.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for whatsapp-chat-exporter 0.13.1
File Size Uploaded
whatsapp_chat_exporter-0.13.1.tar.gz 77.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for whatsapp-chat-exporter 0.13.1
File Interpreter ABI Platform
whatsapp_chat_exporter-0.13.1-py3-none-any.whl Python 3 none any Details

Total release size: 146.6 kB

Release files / whatsapp_chat_exporter-0.13.1.tar.gz

Download URL whatsapp_chat_exporter-0.13.1.tar.gz
Size 77.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a1d480aef7e2ac6e6456aafd6d9254c406bad6f8790f738d6830a3ce4d0552bf
BLAKE2b-256 checksum
How to use checksums
acd9e00e5b08b2e4a8c6d9c45b820797db98817e5b748faefa193f87311a8343
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release files / whatsapp_chat_exporter-0.13.1-py3-none-any.whl

Download URL whatsapp_chat_exporter-0.13.1-py3-none-any.whl
Size 69.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
73e7ef3a8fc95d9b413bb818b9fa57344ffeda150589507c916029dfe440de7f
BLAKE2b-256 checksum
How to use checksums
560864707b95b2462d36efa7d0887e871125bec7fe3fcb9ed4c62c6a3fee3bb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.13.1 This release

2 release files

0.13.0

2 release files

0.12.1

2 release files

0.12.0

2 release files

0.11.2

2 release files

0.11.0

2 release files

0.10.5

2 release files

0.9.7

2 release files

0.9.5

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.5

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page