Format:PK8, PA8 and PK9
| On this wiki | Facts · Code · Notes · Topics |
|---|
Pokémon entity of the Switch games: PK8 (Sword/Shield; 0x148 stored, 0x158 party), PA8 (Legends: Arceus; 0x168 / 0x178) and PK9 (Scarlet/Violet; 0x148 / 0x158): encryption constant, sanity, checksum, then four 80- or 88-byte blocks encrypted with a 16-bit LCG stream seeded by the encryption constant.
The Pokémon record of the Platform:Nintendo Switch games as read from Tool:PKHeX (PK8.cs, PA8.cs, PK9.cs, PokeCrypto.cs). Switch saves hold these records inside structured blocks that PKHeX parses with its own block reader; that part is not covered here.
Sizes
| Format | Stored | Party | Block size |
|---|---|---|---|
| PK8 | 0x148 (8 + 4 x 80) | 0x158 | 80 |
| PA8 | 0x168 (8 + 4 x 88) | 0x178 | 88 |
| PK9 | 0x148 | 0x158 | 80 |
The 0x10 extra party bytes follow the stored part.
Header (not encrypted)
| Offset | Field |
|---|---|
| 0x00 | encryption constant (EC) u32 |
| 0x04 | sanity u16 (0 when valid) |
| 0x06 | checksum u16 |
First fields of the decrypted data (PK9 and PA8 read)
species u16 at 0x08, held item u16 at 0x0A, trainer id u16 at 0x0C and secret id u16 at 0x0E, experience u32 at 0x10, ability u16 at 0x14, markings u16 at 0x18, personality value (PID) u32 at 0x1C.
Encryption
Same scheme as Format:PK4 and PK5 with a different seed and block size: the bytes from 0x08 to the end of the stored part are XORed with the 16-bit LCG stream (seed * 0x41C64E6D + 0x6073, high 16 bits) seeded with the EC; the four blocks are shuffled by (EC >> 13) & 31 using the usual 24 orders. Party bytes use the same stream restarted with the EC. The checksum is the 16-bit sum of the u16 words from 0x08 to the end of the stored part. See Fact:PK8, PA8 and PK9/behavior/Gen 8-9 entity encryption.
Unverified: for PK8 the offsets above are taken from the shared layout of PK9 and PA8 (PK8 derives from a common base class that was not read). Gen 6 and 7 files (PK6/PK7) use the same stream seeded with the PID, 56-byte blocks, 0xE8 stored and 0x104 party bytes, read only in PokeCrypto.cs.
Code & repositories
- https://github.com/kwsch/PKHeX @
641c26ba100225f3605e5a44b61b3b16e15a3774· license: GPL-3.0 (declared by the contributor; GitHub's detector did not recognize LICENSE)
Pokémon save and entity editor; PKHeX.Core is the reference for save sectors, checksums and PK3-PK9 encryption (PokeCrypto.cs, SAV3.cs, PK3.cs, SAV1.cs, SAV2.cs).
Tested on: source read, not run: source read, not run · checked 2026-10-18