A simple Python tool to decode .pz9 and .pa9 Pokémon data files from Pokémon Legends: Z-A.
It extracts core information such as species, nickname, original trainer, and trainer IDs.
- Reads and decodes 344-byte
.pz9and.pa9Pokémon records. - Displays key trainer info:
- Species
- Nickname
- Original Trainer (OT)
- TID (6-digit Trainer ID)
- SID (4-digit SID7 for Gen 7+ games)
- Optionally exports JSON output for each Pokémon.
- Automatically fetches a full species name list using PokeAPI.
Web version: ZA-Decoder Web
The script will automatically find and process all .pz9 and .pa9 files in the current directory.
python pz9_decoder.pyExample output:
Species: Magikarp
Nick: Fish
OT: Set
TID: 021203
SID: 1341
------------------
Species: Pikachu
Nick: Sparky
OT: Ash
TID: 123456
SID: 7890
Creates an outdir/ folder containing a .json file for each .pz9 or .pa9 found.
python pz9_decoder.py --outpython pz9_decoder.py --out results- Python 3.9+
- Requests
pip install requests
- The script identifies
.pz9and.pa9records as 344 bytes long, representing one Pokémon entry. - It extracts key data from fixed offsets:
0x08–0x09→ Species ID0x0C–0x0F→ TrainerID32
- Trainer IDs are derived from the 32-bit
TrainerID32value as follows:- TID7 =
TrainerID32 % 1_000_000→ 6-digit in-game Trainer ID - SID7 =
TrainerID32 // 1_000_000→ 4-digit Secret ID (Gen 7+ format)
- TID7 =
- UTF-16LE encoded strings in the file are used to extract:
- The Pokémon’s nickname
- The Original Trainer (OT) name
- The script can optionally pull full Pokémon species names using PokeAPI, ensuring complete species coverage.
- Output can be printed directly to the console or exported as per-Pokémon JSON files for further analysis.