#genshin-calculator-container .calc-card {
background: #fff;
border-radius: 12px;
box-shadow: 0 4px 20px rgba(0,0,0,0.1);
padding: 25px;
margin-bottom: 30px;
border: 1px solid #e0e0e0;
}
#genshin-calculator-container .calc-header {
text-align: center;
margin-bottom: 25px;
background: #f0f4f8;
padding: 15px;
border-radius: 8px;
border-left: 5px solid #4a90e2;
}
#genshin-calculator-container h3 {
margin: 0;
color: #2c3e50;
font-size: 24px;
}
#genshin-calculator-container .form-group {
margin-bottom: 15px;
}
#genshin-calculator-container label {
display: block;
margin-bottom: 5px;
font-weight: 600;
font-size: 14px;
color: #555;
}
#genshin-calculator-container .input-row {
display: flex;
gap: 15px;
flex-wrap: wrap;
}
#genshin-calculator-container .col-half {
flex: 1;
min-width: 200px;
}
#genshin-calculator-container input[type="number"] {
width: 100%;
padding: 10px;
border: 1px solid #ddd;
border-radius: 6px;
font-size: 16px;
box-sizing: border-box;
transition: border-color 0.3s;
}
#genshin-calculator-container input[type="number"]:focus {
border-color: #4a90e2;
outline: none;
}
#genshin-calculator-container .calc-btn {
width: 100%;
padding: 12px;
background-color: #4a90e2;
color: white;
border: none;
border-radius: 6px;
font-size: 18px;
font-weight: bold;
cursor: pointer;
transition: background-color 0.2s;
margin-top: 10px;
}
#genshin-calculator-container .calc-btn:hover {
background-color: #357abd;
}
#genshin-calculator-container .results-area {
margin-top: 25px;
background: #f9f9f9;
padding: 20px;
border-radius: 8px;
display: none;
border: 1px solid #eee;
}
#genshin-calculator-container .result-row {
display: flex;
justify-content: space-between;
padding: 10px 0;
border-bottom: 1px solid #e0e0e0;
}
#genshin-calculator-container .result-row:last-child {
border-bottom: none;
}
#genshin-calculator-container .result-label {
font-weight: 600;
color: #666;
}
#genshin-calculator-container .result-value {
font-weight: 700;
font-size: 18px;
}
#genshin-calculator-container .crit-value {
color: #e74c3c;
}
#genshin-calculator-container .non-crit-value {
color: #7f8c8d;
}
#genshin-calculator-container .avg-value {
color: #27ae60;
}
#genshin-calculator-container .info-tooltip {
font-size: 12px;
color: #888;
margin-top: 2px;
}
@media (max-width: 600px) {
#genshin-calculator-container .col-half {
min-width: 100%;
}
}
How Genshin Impact Damage is Calculated
Understanding the damage formula in Genshin Impact is essential for optimizing your characters (or "builds"). While the numbers popping up on screen can seem random, they follow a strict mathematical formula involving your stats, the enemy's defense, and resistance.
The Core Damage Formula
The simplified version of the outgoing damage formula is:
Damage = (Total ATK × Talent Scaling) × (1 + DMG Bonus %) × CRIT Multiplier × Enemy Def Multiplier × Enemy Res Multiplier
1. Base Stats & Scaling
Your damage starts with your Total Attack multiplied by the Talent Scaling (the percentage listed in your character's talent description). For example, if you have 2000 ATK and a skill deals 200% damage, your base output is 4000 before other multipliers.
2. DMG Bonus %
This is an additive category that includes:
- Elemental Damage Bonus (Goblet artifact)
- Physical Damage Bonus
- Skill/Burst Damage Bonus (e.g., "The Catch" passive)
- Normal/Charged Attack Bonus (e.g., Gladiator's Finale 4pc)
- All DMG Bonus effects (e.g., Serpent Spine)
All these percentages are added together into a single multiplier. If you have a 46.6% Pyro Cup and a 15% Set Bonus, your multiplier is 1 + 0.466 + 0.15 = 1.616.
3. Defense Multiplier
Enemies have Defense based on their level relative to yours. The formula is approximately:
(Char Level + 100) / [(Char Level + 100) + (Enemy Level + 100)]
If you are Level 90 fighting a Level 90 enemy, the Defense Multiplier is exactly 0.5 (or 50%). This effectively halves your damage. Defense shred (like Raiden Shogun's C2 or Ayaka's C4) modifies the denominator, significantly increasing damage.
4. Resistance Multiplier
Most enemies have a base 10% resistance to all elements. However, some have high resistance (e.g., Ruin Guards have 70% Physical Resistance). Resistance works in tiers:
- 0% to 75%: Reduces damage by the resistance percentage (e.g., 10% res = 0.9 multiplier).
- Below 0% (Shredded): Negative resistance is halved. If you shred an enemy to -20% Res, you gain a 10% damage increase (1.1 multiplier).
- Above 75%: High resistance follows a steeper diminishing returns formula.
Why Average Damage Matters
While seeing a big "Crit" number is satisfying, your Average Damage is the most accurate metric for DPS (Damage Per Second). It accounts for your CRIT Rate. A build with 200% CRIT DMG but only 5% CRIT Rate will deal huge numbers rarely, but very low damage on average. A balanced 1:2 ratio (e.g., 70% Rate / 140% DMG) is usually optimal.
function calculateGenshinDamage() {
// Get inputs
var atk = parseFloat(document.getElementById('gi_total_atk').value);
var scalingPct = parseFloat(document.getElementById('gi_skill_scaling').value);
var dmgBonusPct = parseFloat(document.getElementById('gi_dmg_bonus').value);
var critRatePct = parseFloat(document.getElementById('gi_crit_rate').value);
var critDmgPct = parseFloat(document.getElementById('gi_crit_dmg').value);
var charLevel = parseInt(document.getElementById('gi_char_level').value);
var enemyLevel = parseInt(document.getElementById('gi_enemy_level').value);
var enemyResPct = parseFloat(document.getElementById('gi_enemy_res').value);
var ampMult = parseFloat(document.getElementById('gi_amp_mult').value);
// Validation
if (isNaN(atk) || isNaN(scalingPct) || isNaN(charLevel) || isNaN(enemyLevel)) {
alert("Please fill in all required numeric fields properly.");
return;
}
// Normalize Percentages
var scaling = scalingPct / 100;
var dmgBonus = dmgBonusPct / 100;
var critRate = critRatePct / 100;
var critDmg = critDmgPct / 100;
var enemyRes = enemyResPct / 100;
// Cap Crit Rate for Avg Calc
var effectiveCritRate = Math.min(Math.max(critRate, 0), 1);
// 1. Base Outgoing (ATK * Scaling)
// Note: Does not include Flat DMG (like Shenhe) for simplicity, but basic formula works.
var baseOutgoing = atk * scaling;
// 2. DMG Bonus Multiplier
var bonusMult = 1 + dmgBonus;
// 3. Defense Multiplier
// Formula: (CharLvl + 100) / ((CharLvl + 100) + (EnemyLvl + 100) * (1 – DefShred))
// Assuming 0 Def Shred for this basic calculator
var charFactor = charLevel + 100;
var enemyFactor = enemyLevel + 100;
var defMult = charFactor / (charFactor + enemyFactor);
// 4. Resistance Multiplier
var resMult = 1.0;
if (enemyRes < 0) {
// If resistance is negative, effect is halved
resMult = 1 – (enemyRes / 2);
} else if (enemyRes < 0.75) {
// Standard formula
resMult = 1 – enemyRes;
} else {
// High resistance formula
resMult = 1 / (1 + (4 * enemyRes));
}
// 5. Amp Reaction
if (isNaN(ampMult) || ampMult <= 0) ampMult = 1.0;
// Calculate Final Numbers
var incomingDmg = baseOutgoing * bonusMult * defMult * resMult * ampMult;
var nonCritDmg = incomingDmg;
var critHitDmg = incomingDmg * (1 + critDmg);
var avgDmg = (nonCritDmg * (1 – effectiveCritRate)) + (critHitDmg * effectiveCritRate);
// Display Results
document.getElementById('res_non_crit').innerText = Math.round(nonCritDmg).toLocaleString();
document.getElementById('res_crit_hit').innerText = Math.round(critHitDmg).toLocaleString();
document.getElementById('res_avg_dmg').innerText = Math.round(avgDmg).toLocaleString();
document.getElementById('res_def_mult').innerText = (defMult * 100).toFixed(1) + "%";
document.getElementById('res_res_mult').innerText = (resMult * 100).toFixed(1) + "%";
// Show result area
document.getElementById('gi_result_area').style.display = 'block';
}