Most people know that the ID number on your Trainer Card is not the only one you have. You actually have a second, hidden ID number, known as your secret ID number. However, due to it not being shown, most people think that you can only see it if you use cheats. This is false.

But how can you find your secret ID, when the game doesn't show it to you? There are a few game mechanics that actually allow you to work it out. Here's a quick rundown:
  • All Pokémon have a set of IVs, which control their stats.
  • All Pokémon also have another hidden value, called the personality ID. This controls the Pokémon's gender, ability, nature, and shininess.
  • Each trainer has a public ID number and a secret ID number.
  • Shininess is determined not only by the Pokémon's personality ID, but also its trainer and secret IDs.
  • All these numbers are randomly generated when a Pokémon is created, be it wild or received.
  • The random number generator in Pokémon, despite its appearance, is not random. It's impossible to create a true random number generator with software. The closest you can get is a formula which generates a sequence of seemingly random numbers. However, this means that the numbers are not truly random, as they are generated by a predictable formula.
  • A Pokémon's IVs are generated directly after its personality ID. This means that due to the 'random' number generator, the two sets of values are linked.

These mean that if you know your Pokémon's IVs and nature, you can actually take a good guess at its personality ID. This, your trainer ID, and your secret ID determine shininess. If you catch a shiny, you've got both personality ID and trainer ID covered; these can then be used to calculate possible values for your secret ID.

Now that I have the explanation out of the way, time to move on to the method. Firstly, let me make this clear: you won't be able to work out your exact secret ID. You'll only be able to get a range in which it could be, as though there are 65536 possible secret IDs, the chance of a shiny is 1/8192. Therefore, you'll get a range of 65536/8192=8 different possible secret IDs.
Anyway, first, you need to catch a shiny. If you've already got one, then great; if not, start searching! However, the shiny cannot be cheated or hatched. Shiny cheats affect the generation of the personality ID, and an egg's personality ID is generated at a different time than the IVs. Therefore, with these two, there is no link between the personality ID and the IVs, so the personality ID cannot be calculated.
Then, you need to calculate your shiny's IVs. There's loads of guides on how to do that already; however, if you can't find any, here's a short guide from me.
  1. Get loads of Rare Candies, either by using Pickup or cloning them in Emerald.
  2. Make sure the shiny has no EVs; freshly caught Pokémon always have no EVs (as long as you didn't use vitamins on them). If they're touched, use the Pomeg, Kelpsy, Qualot, Hondew, Grepa and Tamato Berries in Emerald until they have no effect. These Berries remove EVs from your Pokémon.
  3. Then, go to this site. Enter the nature, level and stats of your Pokémon, and press Calculate. Then, use a Rare Candy on it and repeat. Eventually, it will give you the exact IVs of your Pokémon.

Once you have the Pokémon's IVs, it's time to work out its personality ID. Go to this site, and enter the Pokémon's IVs and nature. It will come up with a list of possible personality IDs. Choose the appropriate one for your Pokémon, keeping in mind that any Pokémon caught in the wild will always be method 2 or 3, while legendaries and received Pokémon will be method 1. If there are multiple possibilities for the same method, you'll have to catch another shiny and repeat this whole process, choosing the common secret ID numbers at the end.
Once you have a personality ID for your shiny, go to this site. Yes, it's in Japanese. There should be a Flash applet at the top, with three buttons on the upper right. Click the bottom one of those. You'll see a screen with a space for your ID, and a wider space underneath. That's where you enter the personality ID of the shiny. Once you have entered your ID and the shiny's personality ID, click the large grey button underneath the personality ID. This will make a list of numbers pop up in the big white box. These are your possible secret IDs.
If you had multiple personality ID possibilities, repeat the last step with each one, for two different shinies from the same save file. Two of the secret ID lists should have the same number[s]; these are your possible secret IDs.

As I said earlier, this method won't give you your exact secret ID. However, all of these will give you the same shiny Pokémon personality IDs, so if you're using your secret ID to find the timing for soft-resetting shinies on Emerald, any one of those will work.

If you need any help, or you don't understand part of this guide, please post.