PKHeX is an open-source Pokémon save editor first and a legality checker second, but the legality checker is what makes it load-bearing for the entire genning ecosystem. If a Pokémon passes PKHeX, it will pass Pokémon HOME, Ranked Battle Stadium, and every online validator in the mainline games. Here's why.

What PKHeX actually is

PKHeX is a community-maintained, open-source project that has been reverse-engineering Pokémon game data since Generation 6. It understands the binary format of every mainline game save — every Pokémon slot, every held item, every hidden flag, every RNG relationship. More importantly, it understands what the games would and wouldn't have produced.

That second part is the legality check. PKHeX has encoded, for each game, the rules governing:

  • Which species can appear in which encounters
  • Which moves can be learned where and how
  • Which abilities each species can roll, and in which slots
  • Which balls, origin marks, and met-locations are reachable
  • How the Encryption Constant, PID, Trainer ID, Secret ID, and Shiny flag interact mathematically
  • What ribbons and markings each encounter, event, and transfer can add

A legality check is PKHeX asking: is this Pokémon's data a valid output of the rules I know about for its claimed origin game?

How the check actually runs

PKHeX walks the Pokémon through a series of verifiers. Each verifier owns one slice of the rule set:

  1. Encounter matching. Given the species, origin game, met-location, met-level, ball, and origin marks, does any real encounter slot match? If no slot matches, the check fails immediately.
  2. Move legality. For the matched encounter, is every move in the current move set reachable? Level-up moves up to the current level, egg moves that match the parent chain, TM/TR moves available in the right game, tutor moves that were in fact available.
  3. Ability verification. Is the ability in a slot that this encounter could produce?
  4. Hidden-value math. Do the EC, PID, and Shiny flag satisfy the origin game's RNG rules? Is the Trainer/Secret ID pattern plausible?
  5. Stat verification. IVs match the encounter's guaranteed-perfect-IV rules. EVs are within legal totals. HP / Attack / Defense / Sp.Atk / Sp.Def / Speed align with nature, ability, held item effects.
  6. Ribbon & marking audit. Every ribbon is attributable to a real event or game state. No phantom ribbons.
  7. Transfer history. If the Pokémon claims to have moved through multiple games, each transfer is validated against what the sending and receiving games would have accepted.

Any verifier that returns "invalid" flags the whole Pokémon. Most verifiers can point to the specific issue, which is why PKHeX's output is actionable — "illegal move: Hydro Pump (not learnable by this encounter)" instead of just "illegal."

Why HOME and PKHeX agree

HOME's internal validator and PKHeX are built from the same underlying rule set — the game mechanics themselves. The rules are the game's rules; PKHeX and HOME are two implementations reading the same spec. They drift occasionally when a new game ships and PKHeX hasn't caught up yet, but for everything released and stable, they agree.

That's why a Pokémon that passes PKHeX deposits to HOME. And it's why every serious genning tool — including everything GenPKM touches — uses PKHeX (or a tool built on top of it) as the pre-trade validator.

What PKHeX cannot tell you

Two things:

  • Source. PKHeX cannot tell whether a Pokémon was caught, bred, traded in from another save, or generated. The binary doesn't record its own history that way. Legality is about internal consistency, not provenance.
  • Future rule changes. If Game Freak patches a game and changes what counts as legal, PKHeX only catches up after analysis. A Pokémon built against today's rules might need re-verification against tomorrow's.

Neither limitation matters for day-to-day trading. The first is irrelevant to detection. The second is why GenPKM keeps current with PKHeX updates and rebuilds problematic data whenever the spec moves.

The bottom line

When you trade with GenPKM, every Pokémon has already been through the PKHeX verifier chain for its target game. It has survived the same check that HOME will run when it lands. The match isn't luck — it's the whole design of the system.

Curious about the broader safety question? Start at Is Pokémon Genning Safe?.