This article is about how damage is calculated. For the definition, see Damage. 
DISCLAIMER: The information in this article is based on experimental research conducted by the community, and may contain inaccuracies and speculation. While we strive for accuracy in these articles, we make no claims of experimental rigor or unbiased conclusions. Caveat lector.
Contents

A Simplified Damage Calculation
Note: For simplicity, on this page the term attack describes any attempt to damage an opponent. However, whenever the word "attack" is used in skill descriptions, it refers to the attack action.
There are many different factors to consider while calculating damage. To avoid confusion, this section presents a simplified damage calculation which only takes into consideration the more common factors.
The Approximate Damage (ApproxD) depends on the Raw Damage (RD) and the Armor Effect (AE).
 ApproxD = RD × AE;
For damage that ignores armor, AE is set to 1.
A level 20 character will do the damage stated in the skill description to a character with 60 armor. A level 20 character with 12 in a weapon attribute will do the stated weapon damage to a character with 60 armor.
Raw Damage
Skillbased offense (like Shock) has a specific raw damage (RD) value indicated in the skill description.
Weapon attacks select RD each time uniformly from the damage range of the weapon. For weapons that have an attribute requirement on their damage range, there is actually another hidden range used for when the attacker does not meet the requirement (see here for details).
Armor Effect
The Armor Effect (AE) depends on the difference of Effective Damage Rating(EffDR) and Effective Armor Rating (EffAR):
 AE = 2^{(EffDR  EffAR)/40}
Effective Damage Rating
The Effective Damage Rating (EffDR) is a simple sum of the Base Damage Rating (BaseDR) and any Damage Rating bonuses (DRBonus).
 EffDR = BaseDR + DRBonus
For damage from spells and caster weapons (Staves, Wands, etc), the BaseDR is proportional to the attacker's level.
 BaseDR_{caster} = 3 × Level
For "weaponry" damage (martial weapons and pets  those that have an attribute line for it), the BaseDR depends on the attacker's rank in the respective attribute of the "weapon".
 BaseDR_{noncaster} = 5 × Rank
If the Rank of the linked attribute is greater than a threshold^{1} of Level/2+2, then there is a DRBonus of  3 × [Rank  (Level/2+2)] (negative bonus), serving as a diminishing return. The square bracket term in this case rounds up (towards zero). This threshold only applies to "weaponry" damage, which results in a DRBonus of zero for noncritical hit attacks from spells and spellcasting weapons.
Expressed differently, the DR for noncaster damage is:
 DR_{noncaster} = 5 × Rank; if Rank <= Threshold
 DR_{noncaster} = 5 × Threshold + 2 × (RankThreshold); if Rank > Threshold
 Threshold^{1} = Level /2 + 2
For traps, Damage Rating is same as for spells and caster weapons: 3 x Level.
For a detailed chart showing damage rating at each character level/rank, see Damage Rating progression.
Critical hits grant a DRBonus of 20.
^{1} The equation for the Threshold has only been confirmed for levels 1,8,11,14~16, and 18~20. The equation is interpolated to cover levels 27, 9, 10, 12, 13, and 17, and may not be accurate at those levels.
Armor Rating
The Effective Armor Rating depends on the Base Armor Rating (BaseAR), AR Shifter (ARShift), and Net Armor Penetration (NAP).
 EffAR = BaseAR × (1  NAP) + ARShift
Each attack randomly hits one of the various body locations. The probablity of hitting each location is generally believed to be proportional to the relative armor costs for the same level of armor. If that were true, the probablities would be:
 Chest  3/8
 Legs  2/8
 Head  1/8
 Hands  1/8
 Feet  1/8
However, it is also believed that certain attack skills and spells have a bias towards certain body parts, so they are more likely to hit them. Relative positioning of the attacker and target may also affect which part is more likely to be hit.
The Armor Rating of the piece corresponding to the location attacked is used as the BaseAR, while any bonuses on that armor contributes to ARShift. Certain armor are described as having a negative bonus of Holy Damage you receive is increased by 5, which function regardless of hit location and stacking.
Primary and secondary weapons, as well as skills, may also modify the armor value. They are added to the ARShift regardless of which body location was hit.
Armor penetration can come from the Warrior's Strength attribute, weapon upgrades, or skill properties. Some of them simply have x% armor penetration, whereas others provide +y% armor penetration. Pick the highest x (if none, use 0), and add all the y's to it to obtain the net armor penetration (NAP). Note that NAP is a real number between 0 and 1; remember to divide percentage values by 100 (20% → 0.2, etc.).
Effective Damage
The Effective Damage (ED) considers all the Damage Modifiers that were dropped when calculating the Approximate Damage. The ED depends on the Raw Damage (RD), various Damage Modifiers (D*), and the Armor Effect (AE).
 ED = [([RD × DScale × AE] + DShift) × DMult] + DNeg
Again, for attacks that ignore armor, AE is set to 1, essentially removing it from the equation.
Damage Modifiers
Modifier  Stack by  How to identify  Examples 

Notes  
Damage Scaler (DScale) 
Multiplication  Percent modification of damage 

 
Damage Shifter (DShift) 
Addition  fixed amount of + or  damage 

 
Damage Multiplier (DMult) 
Multiplication  "Double" or "Half" 

Damage Negator (DNeg) 
Addition  gets healed instead of taking damage  

DScale, and DMult are by default 1; whereas DShift and DNegate are by default 0.
Damage Cap and Redirection
Certain enchantments will restrict the maximum damage the target can receive, or redirect some of the damage away from the target, thus making the received damage less than the Effective Damage. Redirection is always applied before the cap.
Notes
Every 8 ranks in a physical damage attribute thus doubles the net noncaster damage caused; similarly, every 13 character levels doubles caster damage. The accounting per rank or level is as follows: every rank in attack attributes scales the damage by exactly a factor of 2^{(1/8)} (roughly 9%), and every character level scales the caster damage by 2^{3/40} (roughly 5.33%). Note that the effect of cumulative ranks or levels is compounded; for example, 5 ranks in an attack attribute doesn't increase damage by 45%, but by (1.09^{5}  1) × 100 ≈ 53%.
It is important to keep in mind that certain skills such as Greater Conflagration and Judge's Insight change the damage type, and therefore can have an effect on AR bonuses or DR calculation. The articles on these skills explain their damage type changes in more detail. Only in the early PvE game, advanced PvE areas, or in exceptional situations is the EffectiveAR actually less than the EffectiveDR, so the AE generally always reduces the effective damage. The philosophy behind the AE scale can be seen as follows: in the prototypical case where the attacker and target are roughly equal PvP players, the attacker's ranked 12 noncaster attack or normal caster attack at character level 20 will exactly negate the target's EffectiveAR of 60 (standard for all spell caster PvP armor).
The AE equation gives us a handy rule of thumb: every 40 increase (decrease) in EffectiveAR halves (doubles) the amount of normal damage (i.e., damage not caused by armor ignoring attacks). A Warrior with 100 armor against physical damage being whacked by a sword will take half as much damage as any 60 armor Elementalist being whacked by the same sword. Skills such as Healing Signet temporarily reduce AR by 40, which translates to double damage for normal attacks. An increase of approximately 16 armor would correspond to taking 75% damage. (Many ranger insignia such as Pyrebound or Frostbound give AR bonuses of +15.)
Consider a Mesmer, an Elementalist, and a Ranger being hit by the same attribute level 16, caster level 20 Fireball. The Mesmer with only 60 armor takes all 119 damage. The Elementalist has Pyromancer's insignia with 75 armor against fire and takes 92. The Ranger wears Pyrebound insignia for 100 armor against elemental damage so he takes 60 damage.
Illustrative Examples
A Simple Example
You are a Warrior, with 16 Swordsmanship and wielding a Vampiric Longsword of Fortitude, attacking a Monk, who has 70 armor (either from a Blessed Insignia or Stalwart Insignia), with a normal attack.
Raw Damage
The minimum Raw Damage is 15 and the maximum is 22. (Life steal is not considered damage by the game and doesn't count.)
Damage Rating
Using the second formula,
 DR_{noncaster} = 5 × Rank; if Rank <= Threshold
 DR_{noncaster} = 5 × Threshold + 2 × (RankThreshold); if Rank > Threshold
 Threshold^{1} = Level /2 + 2
Your rank in Sword Mastery exceeds the threshold (which is 12 for a level 20 character), so your Damage Rating is DR_{noncaster} = 5 × Threshold + 2 × (RankThreshold) = 5 × 12 + 2 × 4 = 68
Armor Rating
The monks BaseAR is 60  standard caster armor.
She is using Stalwart (or Blessed) Insignia, but she is not using any +armor mods on her weapon, so her ARShift is +10. You have no armor penetration.
Her Armor Rating is EffAR = BaseAR × (1  NAP) + ARShift = 60 + 10 = 70
Using the formula for Armor Effect, AE = 2^{(EffDR  EffAR)/40} = 2^{(68  70)/40} = 2^{(2)/40}
Using a calculator (or the chart), gives an Armor Effect of 96%. Which takes us all the way back to the first equation. Your Approximate Damage is (1522) × 96% = (14  21). Not very spectacular, but it's the process that is important.
An Unnecessarily Complicated Example
You are a Warrior, with 16 Axe Mastery and 10 Strength this time and wielding a Sundering Chaos Axe of Fortitude, attacking a Monk, who has 70 armor and is under the effect of Dark Escape. Your first attack is Executioner's Strike, followed by Critical Chop.
 ED = [([RD × DScale × AE] + DShift) × DMult] + DNeg
The First Attack (Executioner's Strike)
Armor Effect
As before, you have a Damage Rating of 68 (at level 20 and 16 weapon mastery), but the Armor Rating has changed, due to armor penetration. Your Sundering prefix does not trigger.
The new Armor Rating is EffAR = BaseAR × (1  NAP) + ARShift = 60 × (1  0.10) + 10 = 64
Which gives a total Armor Effect of 107%.
Damage Scale
Your axe does +15% from its inscription and +20% damage from customization, for a total Damage Scale of 38%.
Damage Shifter
You have no external damage bonus other than your attack skill, like Strength of Honor or Order of Pain, so the Damage Shifter is +42 (level 16 on Executioner's Strike).
Damage Multiplier
Dark Escape gives the monk a Damage Multiplier of 1/2.
Damage Negator
None
Effective Damage
The new raw damage for your axe is 628, giving a final formula of ED = [([RD × DScale × AE] + DShift) × DMult] + DNeg
The minimum damage is ED = [([6 × (1.20 × 1.15) × 1.07] + 42) × 0.5] + 0 = 25
The maximum damage is ED = [([28 × (1.20 × 1.15) × 1.07] + 42) × 0.5] + 0 = 41
The Second Attack (Critical Chop)
Armor Effect
As before, you have a Damage rating of 68, and the Monk's Armor Level is still the same. But this time, the Sundering Prefix triggers. So we have a new Armor Rating: EffAR = BaseAR × (1  NAP) + ARShift = 60 × (1  0.30) + 10 = 52
This gives a total Armor Effect of 132%. To avoid any inaccuracies we will use the exact term: 2^{0.4}
Damage Scale
Your axe does +15% from its inscription and +20% damage from customisation, for a total Damage Scale of 38%.
Damage Shifter
You have no external damage bonus other than your attack skill, like Strength of Honor or Order of Pain, so the Damage Shifter is +21 (level 16 on Critical Chop).
Damage Multiplier
Dark Escape gives the monk a Damage Multiplier of 1/2.
Damage Negator
None
Effective Damage
The raw damage for your axe is 628, giving a final formula of ED = [([RD × DScale × AE] + DShift) × DMult] + DNeg
The minimum damage is ED = [([6 × (1.20 × 1.15) × 2^{0.4}] + 21) × 0.5] + 0 = 16
The maximum damage is ED = [([28 × (1.20 × 1.15) × 2^{0.4}] + 21) × 0.5] + 0 = 36
Related Articles
Original References
The present article is built on the results of the research laid out in the original unannotated version of the following article, with additional original research conducted by users of the GuildWiki.
This is a clearer, more elegant explanation of the Simplified Damage Formula A Treatise on Combat Mathematics on Guildwars Guru.