From Glitch City Laboratories
"ID number" redirects here, for the player's ID number, or 'secret ID' please see Bulbapedia's respective article.
In the Pokémon games, an identifier (also index number or ID number) is a number used within the game's code to identify pieces of data. Pokémon, items, locations, moves, and abilities all have unique identifiers; in each game, no two Pokémon have the same identifier. Pieces of data in different categories, however, may share identifiers -- a Pokemon and an item may use the same identifier, for instance. Identifiers may be likened to character codes in computer text.
In the first generation (Red/Blue and Yellow versions), the Pokémon's identifiers did not match the PokéDex numbers assigned to them (PokéDex number 1 is assigned to Bulbasaur, while identifier 1 is assigned to Rhydon). The identifier, not the PokéDex number, must be used for cheat codes and in-game tricks like the Old Man Trick or Ditto Trick. This was fixed in the second generation. Item identifiers are relatively constant throughout generations (i.e. item ID 1 is always the Master Ball).
An identifier is also referred to as a "hex", due to the fact that identifiers are almost always represented in hexadecimal notation.
Identifiers by generation