A lightweight, standalone, and completely offline Python utility designed to convert arbitrary text, keys, passwords, or data into a list of words from the standard BIP-39 wordlist (or their respective numerical indices) and back.
It utilizes zlib compression to minimize the output length, making it highly efficient for backing up credentials, seeds, or configurations on paper or offline storage.
- Compression: The text is compressed using
zlibwith the maximum compression level (9) to reduce size. - Padding Protection: A prefix byte (
0x01) is prepended to the compressed bytes. This guarantees that any leading zero bytes are preserved during integer conversion. - Base2048 Encoding: The resulting large integer is converted into base-2048, mapping directly to the standard 2048-word BIP-39 wordlist.
- Reconstruction: The BIP-39 words or indices are converted back into a large integer.
- Prefix Stripping: The integer is serialized back to bytes, and the prepended
0x01byte is removed. - Decompression: The remaining bytes are decompressed via
zlibto restore the exact original text.
We provide a standalone, responsive web interface in index.html.
- Zero Dependencies: It uses native browser APIs (
CompressionStream/DecompressionStream) for compression and decompression. - 100% Offline: You can download
index.htmland open it on any air-gapped computer without an internet connection. - Easy to Use: A beautiful tabbed layout for encoding and decoding with one-click copy-to-clipboard buttons.
This script is designed to be highly versatile. You can run it in three different ways:
Simply run the script with no arguments. It will prompt you interactively:
python bip39_converter.pyInteractive Prompt:
[ BIP-39 DATA CONVERTER ]
1. Encode text (Compress -> BIP-39 words)
2. Decode BIP-39 data (Words/Indices -> Original text)
Select an option (1 or 2):
Perfect for terminal usage, scripting, and pipelines:
- To Encode:
python bip39_converter.py --encode "my super secret password or private key" - To Decode:
python bip39_converter.py --decode "fog alone couch below powder"
If you prefer opening the script in an editor (like VS Code, PyCharm, or IDLE), you can modify the configuration panel at the bottom of bip39_converter.py:
# --- QUICK CONFIGURATION ---
TEXT_TO_ENCODE = """Your text goes here"""
WORDS_TO_DECODE = """"""The parser is highly flexible and automatically detects the input format:
- Space-separated BIP-39 Words:
fog alone couch below powder - Space-separated Indices:
722 55 391 166 1353 - Dash-separated Indices:
722-55-391-166-1353 - 4-Digit Zero-Padded Dash-Separated Indices:
0722-0055-0391-0166-1353
- Offline First: The script has zero external dependencies and uses only Python standard library modules (
zlib,re,sys,hashlib,argparse). - No Network Activity: It does not make any network requests.
- Deterministic: The encoding is fully deterministic; encoding the same text with the same zlib implementation will yield the exact same word sequence.
This project is open-source and licensed under the MIT License.
Contributions, bug reports, and feature suggestions are welcome! Feel free to fork this repository, submit Pull Requests, or open Issues.