Damage Formula
[math] Damage=\floor{\Bigg({\frac{\big({\frac{2\times Level}{5}}+2\big)\times Power\times {\frac{A}{D}}}{50}}\times Targets\times Weather\times Badge\times Critical\times Random\times STAB\times Type\times Burn\times Other\Bigg)+2} [/math]
All divisions are performed on integers, and as such are integer divisions, meaning decimal places are truncated. This effect can be achieved by dividing integers directly, or dividing numbers as floatingpoint numbers and truncating (floor) the result.
For this calculation, all multiplication is also carried out on integers, meaning the decimal places are truncated after multiplication. To demonstrate;
Let [imath]a=21[/imath], and let two imaginary multipliers [imath]b=0.75,\:c=1.5[/imath]. Multiplying [imath]a\times b\times c[/imath] according to these rules results in the following calculation:
[math]z=\floor{\floor{a\times b}\times c}=\floor{\floor{21\times 0.75}\times 1.5}=\floor{\floor{15.75}\times 1.5}=\floor{15\times 1.5}=\floor{22.5}=22[/math]
So we see the result is 22, despite typical multiplication resulting in [imath]23.625[/imath], or [imath]23[/imath] when truncated. This is something to look out for.
The variables used in the formula above are as follows:
Accuracy stage modifiers [imath]A_{user}[/imath]:
Evasion stage modifiers [imath]E_{target}[/imath]:
Note that evasion stages are identical to the matching accuracy stages, but in reverse.
For an explanation why only the first two generations are listed, see Move Accuracy, Generations III and up.
Nature Statistics Modifiers
[math] Damage=\floor{\Bigg({\frac{\big({\frac{2\times Level}{5}}+2\big)\times Power\times {\frac{A}{D}}}{50}}\times Targets\times Weather\times Badge\times Critical\times Random\times STAB\times Type\times Burn\times Other\Bigg)+2} [/math]
All divisions are performed on integers, and as such are integer divisions, meaning decimal places are truncated. This effect can be achieved by dividing integers directly, or dividing numbers as floatingpoint numbers and truncating (floor) the result.
For this calculation, all multiplication is also carried out on integers, meaning the decimal places are truncated after multiplication. To demonstrate;
Let [imath]a=21[/imath], and let two imaginary multipliers [imath]b=0.75,\:c=1.5[/imath]. Multiplying [imath]a\times b\times c[/imath] according to these rules results in the following calculation:
[math]z=\floor{\floor{a\times b}\times c}=\floor{\floor{21\times 0.75}\times 1.5}=\floor{\floor{15.75}\times 1.5}=\floor{15\times 1.5}=\floor{22.5}=22[/math]
So we see the result is 22, despite typical multiplication resulting in [imath]23.625[/imath], or [imath]23[/imath] when truncated. This is something to look out for.
The variables used in the formula above are as follows:
 [imath]Level=\text{Attacking Pokémon Level}[/imath]
 Generation I:
If this move is a critical hit, [imath]Level=2\times \text{Attacking Pokémon's Level}[/imath]
 Generation I:
 [imath]Power=\text{The effective power of the move used}[/imath]. This takes modifiers and multipliers of the move's effect into account.
 [imath]A=\text{The effective attack or special attack statistic of the attacking Pokémon}[/imath]. If the move is a physical move, the Attack statistic is used, or the Special Attack statistic otherwise. This effective attack statistic is what attackmodifying abilities or moves apply to.
 Generation II:
 Critical hit: No modifiers are applied.
 Not a critical hit: [imath]A[/imath] is multiplied by the Attack Stage Modifier of the Pokémon.
 Generation I, III, IV, V, VI, VII, VII:
 Critical hit: [imath]A[/imath] is multiplied by the Attack Stage Modifier of the Pokémon unless the Attack stage is negative.
 Not a critical hit: [imath]A[/imath] is multiplied by the Attack Stage Modifier of the Pokémon.
 Generation II:
 [imath]D=\text{The effective defense or special defense statistic of the defending Pokémon}[/imath]. If the move is a physical move, the Defense statistic is used, or the Special Defense statistic otherwise. This effective defense statistic is what defensemodifying abilities or moves apply to.
 Generation II:
 Critical hit: No modifiers are applied.
 Not a critical hit: [imath]D[/imath] is multiplied by the Defense Stage Modifier of the Pokémon.
 Generation I, III, IV, V, VI, VII, VII:
 Critical hit: [imath]D[/imath] is multiplied by the Defense Stage Modifier of the Pokémon unless the Defense stage is positive.
 Not a critical hit: [imath]D[/imath] is multiplied by the Defense Stage Modifier of the Pokémon.
 Generation II:
 [imath]Targets[/imath]. The number of targets applies to the number of nonfainted inreach targets that you could target in one turn with the move.
 One target: [imath]Targets=1[/imath]
 More than one target:
 Generation III: [imath]Targets=0.5[/imath]
 Generation I, II, IV, V, VI, VII, VIII: [imath]Targets=0.75[/imath]
 [imath]Weather[/imath]
 Rain & Watertype move or Harsh Sunlight & Firetype move: [imath]Weather=1.5[/imath]
 Rain & Firetype move or Harsh Sunlight & Watertype move: [imath]Weather=0.5[/imath]
 None of aforementioned combinations: [imath]Weather=1[/imath]
 [imath]Badge[/imath]
 Generation II:
 Obtained badge of the move's type: [imath]Badge=1.25[/imath]
 Not obtained badge of the move's type: [imath]Badge=1.25[/imath]
 Generation I, III, IV, V, VI, VII, VIII: [imath]Badge=1[/imath]
 Generation II:
 [imath]Critical[/imath]
 Critical hit:
 Generation I: [imath]Critical=1[/imath] (because it is already applied in [imath]Level[/imath])
 Generation II, III, IV, V: [imath]Critical=2[/imath]
 Generation VI, VII, VIII: [imath]Critical=1.5[/imath]
 Not a critical hit: [imath]Critical=1[/imath]
 Critical hit:
 [imath]Random=rand(0.85, 1.0)^{inclusive}[/imath]
 [imath]STAB[/imath]
 User has move's type: [imath]STAB=1.5[/imath]
 User doesn't have move's type: [imath]STAB=1[/imath]
 [imath]Type=2^{effectiveness}[/imath] where [imath]effectiveness[/imath] is the sum of effectiveness for the move's type compared to all the target's targets. If the move's type is super effective against a type, [imath]effectiveness[/imath] is increased by 1, and decreased by 1 if it's not very effective. If the move is super effectiveness against both the target's type, [imath]effectiveness=2^2=4[/imath], or if it's not very effective against both the types, [imath]effectiveness=2^{2}=0.25[/imath].
 [imath]Burn[/imath]
 User is burned and move is physical: [imath]Burn=0.5[/imath]
 User not burned or move not physical: [imath]Burn=1[/imath]
 [imath]Other[/imath]. The product of various ability and item effects.
Generation I & II  Generation III, IV, V, VI, VII, VIII  
Pokémon Max HP Statistic  [math]
HP=\floor{\frac{\Bigg((Base+IV)\times 2+\floor{\frac{\ceil{\sqrt{EV}}}{4}}\Bigg)\times Level}{100}}+Level+10[/math] All divisions are performed on integers, and as such are integer divisions, meaning decimal places are truncated. This effect can be achieved by dividing integers directly, or dividing numbers as floatingpoint numbers and truncating (floor) the result. In generation I & II, the HP statistic did not have its HP IV as part of the Pokémon data. Instead, it it composed of the other four IVs (Attack, Defense, Speed and Special). It creates a bitstring by taking the least significant bit of those four stats in that order, creating a new 4bit IV value for the HP statistic. Furthermore, the EV value for each statistic is stored as a 16bit number. Upon defeating a Pokémon, the base stats of the defeated Pokémon become the EV values that are added to the winning Pokémon's EVs. The variables used in the formula above are as follows:
 [math]
HP=\floor{\frac{(2\times Base+IV+\floor{\frac{EV}{4}})\times Level}{100}}+Level+10
[/math] All divisions are performed on integers, and as such are integer divisions, meaning decimal places are truncated. This effect can be achieved by dividing integers directly, or dividing numbers as floatingpoint numbers and truncating (floor) the result. The HP statistic got its own dedicated IV value from generation III and onward, and it now ranges from 0 to 31. The EV values are now just 8 bits, and each Pokémon defines a set of EVs it gives out when it has been defeated. The variables used in the formula above are as follows:

Other Pokemon Statistic  [math]
Stat=\floor{\frac{\Bigg((Base+IV)\times 2+\floor{\frac{\ceil{\sqrt{EV}}}{4}}\Bigg)\times Level}{100}}+5
[/math] All divisions are performed on integers, and as such are integer divisions, meaning decimal places are truncated. This effect can be achieved by dividing integers directly, or dividing numbers as floatingpoint numbers and truncating (floor) the result. The variables used in the formula above are as follows:
 [math]
Stat=\floor{\Bigg(\floor{\frac{(2\times Base+IV+\floor{\frac{EV}{4}})\times Level}{100}}+5\Bigg)\times Nature}
[/math] All divisions are performed on integers, and as such are integer divisions, meaning decimal places are truncated. This effect can be achieved by dividing integers directly, or dividing numbers as floatingpoint numbers and truncating (floor) the result. The variables used in the formula above are as follows:
The Nature multiplier depends on the exact nature. If the statistic is increased by the active nature, [imath]e=1.1[/imath]. If the statistic is decreased by the active nature, [imath]e=0.9[/imath]. Otherwise, [imath]e=1[/imath]. A table with all values can be found in the Nature Statistics Modifiers table. 
Move Accuracy  [math]P_{land}=A_{move}\times A_{user}\times E_{target}BrightPowder[/math] The variables in the formula above are as follows:
[imath]^2[/imath]: The modifier table for the evasion statistic can be found in a different table titled Evasion Stage Modifier. A random number [imath]r[/imath] is then generated between 0 and 255, and is compared with [imath]P_{land}[/imath]. Generation I: If [imath]r\lt P_{land}[/imath], the move hits. Otherwise, the move misses. This means that even moves that have perfect accuracy ([imath]P_{land}=255[/imath]) can miss when [imath]r=255[/imath]. This was fixed in generation II. Generation II: If [imath]r\lt P_{land}\vee P_{land}=255[/imath], the move hits. Otherwise the move misses. The formula is the same as generation I, but with an added check to test if [imath]P_{land}=255[/imath].  [math]P_{land}=A_{move}\times A_{stage}\times A_{other}[/math] The variables in the formula above are as follows:
If [imath]r\leq P_{land}[/imath], the move hits. otherwise, the move misses. 
Accuracy stage modifiers [imath]A_{user}[/imath]:
Accuracy Stage  6  5  4  3  2  1  0  +1  +2  +3  +4  +5  +6 
Generation I  [imath]\frac{25}{100}[/imath]  [imath]\frac{28}{100}[/imath]  [imath]\frac{33}{100}[/imath]  [imath]\frac{40}{100}[/imath]  [imath]\frac{50}{100}[/imath]  [imath]\frac{66}{100}[/imath]  [imath]\frac{100}{100}[/imath]  [imath]\frac{150}{100}[/imath]  [imath]\frac{200}{100}[/imath]  [imath]\frac{250}{100}[/imath]  [imath]\frac{300}{100}[/imath]  [imath]\frac{350}{100}[/imath]  [imath]\frac{400}{100}[/imath] 
Generation II  [imath]\frac{33}{100}[/imath]  [imath]\frac{36}{100}[/imath]  [imath]\frac{43}{100}[/imath]  [imath]\frac{50}{100}[/imath]  [imath]\frac{60}{100}[/imath]  [imath]\frac{75}{100}[/imath]  [imath]\frac{100}{100}[/imath]  [imath]\frac{133}{100}[/imath]  [imath]\frac{166}{100}[/imath]  [imath]\frac{200}{100}[/imath]  [imath]\frac{233}{100}[/imath]  [imath]\frac{266}{100}[/imath]  [imath]\frac{300}{100}[/imath] 
Generation III, IV  [imath]\frac{33}{100}[/imath]  [imath]\frac{36}{100}[/imath]  [imath]\frac{43}{100}[/imath]  [imath]\frac{50}{100}[/imath]  [imath]\frac{60}{100}[/imath]  [imath]\frac{75}{100}[/imath]  [imath]\frac{100}{100}[/imath]  [imath]\frac{133}{100}[/imath]  [imath]\frac{166}{100}[/imath]  [imath]\frac{200}{100}[/imath]  [imath]\frac{250}{100}[/imath]  [imath]\frac{266}{100}[/imath]  [imath]\frac{300}{100}[/imath] 
Generation V, VI, VII, VIII  [imath]\frac{3}{9}[/imath]  [imath]\frac{3}{8}[/imath]  [imath]\frac{3}{7}[/imath]  [imath]\frac{3}{6}[/imath]  [imath]\frac{3}{5}[/imath]  [imath]\frac{3}{4}[/imath]  [imath]\frac{3}{3}[/imath]  [imath]\frac{4}{3}[/imath]  [imath]\frac{5}{3}[/imath]  [imath]\frac{6}{3}[/imath]  [imath]\frac{7}{3}[/imath]  [imath]\frac{8}{3}[/imath]  [imath]\frac{9}{3}[/imath] 
Evasion stage modifiers [imath]E_{target}[/imath]:
Note that evasion stages are identical to the matching accuracy stages, but in reverse.
For an explanation why only the first two generations are listed, see Move Accuracy, Generations III and up.
Evasion Stage  6  5  4  3  2  1  0  +1  +2  +3  +4  +5  +6 
Generation I  [imath]\frac{400}{100}[/imath]  [imath]\frac{350}{100}[/imath]  [imath]\frac{300}{100}[/imath]  [imath]\frac{250}{100}[/imath]  [imath]\frac{200}{100}[/imath]  [imath]\frac{150}{100}[/imath]  [imath]\frac{100}{100}[/imath]  [imath]\frac{66}{100}[/imath]  [imath]\frac{50}{100}[/imath]  [imath]\frac{40}{100}[/imath]  [imath]\frac{33}{100}[/imath]  [imath]\frac{28}{100}[/imath]  [imath]\frac{25}{100}[/imath] 
Generation II  [imath]\frac{300}{100}[/imath]  [imath]\frac{266}{100}[/imath]  [imath]\frac{233}{100}[/imath]  [imath]\frac{200}{100}[/imath]  [imath]\frac{166}{100}[/imath]  [imath]\frac{133}{100}[/imath]  [imath]\frac{100}{100}[/imath]  [imath]\frac{75}{100}[/imath]  [imath]\frac{60}{100}[/imath]  [imath]\frac{50}{100}[/imath]  [imath]\frac{43}{100}[/imath]  [imath]\frac{36}{100}[/imath]  [imath]\frac{33}{100}[/imath] 
Nature Statistics Modifiers
Nature  Increased Statistic  Decreased Statistic 
Hardy  None  None 
Docile  None  None 
Serious  None  None 
Bashful  None  None 
Quirky  None  None 
Lonely  Attack  Defense 
Brave  Attack  Speed 
Adamant  Attack  Special Attack 
Naughty  Attack  Special Defense 
Bold  Defense  Attack 
Relaxed  Defense  Speed 
Impish  Defense  Special Attack 
Lax  Defense  Special Defense 
Timid  Speed  Attack 
Hasty  Speed  Defense 
Jolly  Speed  Special Attack 
Naive  Speed  Special Defense 
Modest  Special Attack  Attack 
Mild  Special Attack  Defense 
Quiet  Special Attack  Speed 
Rash  Special Attack  Special Defense 
Calm  Special Defense  Attack 
Gentle  Special Defense  Defense 
Sassy  Special Defense  Speed 
Careful  Special Defense  Special Attack 