Punnett Square Inheritance Calculator
ANA›Life Services Authority›National Calculator Authority›Punnett Square Inheritance Calculator
.calc-container { max-width: 640px; margin: 2rem 0; padding: 1.5rem; background: #fff; border: 1px solid #ddd; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); font-family: system-ui, -apple-system, sans-serif; } .calc-container h3 { font-family: Georgia, serif; font-size: 1.15rem; color: #1a1a1a; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--ac, #3d5a80); } .calc-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; flex-wrap: wrap; } .calc-row label { min-width: 160px; font-size: 0.9rem; color: #333; font-weight: 500; } .calc-row input[type="number"], .calc-row select { flex: 1; min-width: 120px; max-width: 200px; padding: 0.5rem 0.6rem; border: 1px solid #ccc; border-radius: 4px; font-size: 0.9rem; font-family: system-ui, sans-serif; color: #1a1a1a; background: #fafaf8; } .calc-row input:focus, .calc-row select:focus { outline: none; border-color: var(--ac, #3d5a80); box-shadow: 0 0 0 2px rgba(26,74,138,0.12); } .calc-row .unit { font-size: 0.82rem; color: #888; min-width: 30px; } .calc-btn { display: inline-block; margin-top: 0.5rem; padding: 0.55rem 1.5rem; background: var(--ac, #3d5a80); color: #fff; border: none; border-radius: 4px; font-size: 0.9rem; font-weight: 600; cursor: pointer; font-family: system-ui, sans-serif; } .calc-btn:hover { opacity: 0.9; } .calc-result { margin-top: 1.25rem; padding: 1rem 1.25rem; background: #f0f6fc; border-left: 3px solid var(--ac, #3d5a80); border-radius: 0 6px 6px 0; display: none; } .calc-result.visible { display: block; } .calc-result-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: #666; margin-bottom: 0.25rem; } .calc-result-value { font-size: 1.6rem; font-weight: 700; color: var(--ac, #3d5a80); } .calc-result-detail { font-size: 0.85rem; color: #555; margin-top: 0.5rem; line-height: 1.5; } .calc-note { margin-top: 1rem; font-size: 0.8rem; color: #888; font-style: italic; } .calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 0.75rem; } .calc-grid-item { padding: 0.6rem 0.8rem; background: #f8f9fa; border-radius: 4px; border: 1px solid #eee; } .calc-grid-item .label { font-size: 0.75rem; color: #888; text-transform: uppercase; letter-spacing: 0.04em; } .calc-grid-item .value { font-size: 1.1rem; font-weight: 600; color: #1a1a1a; } @media (max-width: 720px) { .calc-row { flex-direction: column; align-items: flex-start; gap: 0.3rem; } .calc-row label { min-width: auto; } .calc-row input[type="number"], .calc-row select { max-width: 100%; width: 100%; } .calc-grid { grid-template-columns: 1fr; } } .calc-chart { margin: 1rem 0; text-align: center; } .calc-chart svg { max-width: 100%; height: auto; } .calc-chart-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem 1.2rem; margin-top: 0.6rem; font-size: 0.8rem; color: #555; } .calc-chart-legend span { display: inline-flex; align-items: center; gap: 0.3rem; } .calc-chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; font-style: normal; } .calc-related { max-width: 640px; margin: 2rem 0 1rem; padding: 1.25rem 1.5rem; background: #f8f9fa; border: 1px solid #e8e8e8; border-radius: 8px; } .calc-related h3 { font-family: Georgia, serif; font-size: 1rem; color: #1a1a1a; margin: 0 0 0.75rem; padding-bottom: 0.4rem; border-bottom: 2px solid var(--ac, #3d5a80); } .calc-related-list { list-style: none; padding: 0; margin: 0 0 0.75rem; display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem 1.5rem; } .calc-related-list li a { font-size: 0.88rem; color: var(--ac, #3d5a80); text-decoration: none; } .calc-related-list li a:hover { text-decoration: underline; } .calc-browse-all { margin: 0.5rem 0 0; font-size: 0.9rem; font-weight: 600; } .calc-browse-all a { color: var(--ac, #3d5a80); text-decoration: none; } .calc-browse-all a:hover { text-decoration: underline; } @media (max-width: 720px) { .calc-related-list { grid-template-columns: 1fr; } }
Punnett Square Inheritance Calculator
Calculate the probability of offspring genotypes and phenotypes for monohybrid or dihybrid crosses using Punnett square analysis.
Cross Type:
Monohybrid Cross (1 gene) Dihybrid Cross (2 genes)
Parent 1 Genotype:
Parent 2 Genotype:
Dominant Trait Name (optional):
Recessive Trait Name (optional):
Parent 1 Genotype:
Parent 2 Genotype:
Gene A Dominant Trait:
Gene A Recessive Trait:
Gene B Dominant Trait:
Gene B Recessive Trait:
Calculate
#### Formula & Method
Monohybrid Cross: Each parent contributes one allele per gene. A 2×2 Punnett square yields 4 possible offspring combinations. Probabilities are calculated as the fraction of each genotype out of 4 total boxes.
Dihybrid Cross: Each parent contributes one allele per gene for two independent genes. A 4×4 Punnett square yields 16 possible offspring combinations. Probabilities are calculated as the fraction of each genotype/phenotype out of 16 total boxes.
Genotype Probability: P(genotype) = count of that genotype in square ÷ total boxes
Phenotype Probability: Dominant phenotype = any genotype with at least one dominant allele (e.g., AA or Aa). Recessive phenotype = homozygous recessive only (aa).
Genotypic Ratio (Monohybrid Aa × Aa): 1 AA : 2 Aa : 1 aa
Phenotypic Ratio (Monohybrid Aa × Aa): 3 Dominant : 1 Recessive
Phenotypic Ratio (Dihybrid AaBb × AaBb): 9 A_B_ : 3 A_bb : 3 aaB_ : 1 aabb
#### Assumptions & References
- Reference: Mendel, G. (1866). Versuche über Pflanzenhybriden. Verhandlungen des naturforschenden Vereines in Brünn.
- Reference: Griffiths, A.J.F. et al. Introduction to Genetic Analysis, 12th ed. W.H. Freeman.
function punToggleCross() { var type = document.getElementById('pun-cross-type').value; document.getElementById('pun-mono-section').style.display = type === 'mono' ? '' : 'none'; document.getElementById('pun-di-section').style.display = type === 'di' ? '' : 'none'; document.getElementById('pun-result').style.display = 'none'; }
function punGetGametes(genotype) { // Returns array of gametes from a 2-allele genotype string e.g. "Aa" -> ["A","a"] if (genotype.length !== 2) return null; var a1 = genotype[0], a2 = genotype[1]; return [a1, a2]; }
function punGetDiGametes(genotype) { // Returns array of 4 gametes from a 4-allele dihybrid genotype e.g. "AaBb" -> ["AB","Ab","aB","ab"] if (genotype.length !== 4) return null; var a1 = genotype[0], a2 = genotype[1], b1 = genotype[2], b2 = genotype[3]; return [a1+b1, a1+b2, a2+b1, a2+b2]; }
function punNormalizeGenotype(g) { // Sort so dominant (uppercase) comes first: "aA" -> "Aa" if (g.length === 2) { var c1 = g[0], c2 = g[1]; if (c1 === c1.toLowerCase() && c2 === c2.toUpperCase()) return c2 + c1; return g; } if (g.length === 4) { var a = punNormalizeGenotype(g[0]+g[1]); var b = punNormalizeGenotype(g[2]+g[3]); return a + b; } return g; }
function punIsDominantPhenotype(genotype) { // At least one uppercase allele return genotype[0] === genotype[0].toUpperCase() || genotype[1] === genotype[1].toUpperCase(); }
function punBuildMonoSquare(g1, g2, domTrait, recTrait) { var gametes1 = punGetGametes(g1); var gametes2 = punGetGametes(g2); if (!gametes1 || !gametes2) return null;
var results = []; for (var i = 0; i '; html += ''; html += '' + gametes2[0] + ''; html += '' + gametes2[1] + ''; for (var i = 0; i ' + gametes1[i] + ''; for (var j = 0; j ' + cell + ''; } html += ''; } html += '';
// Ratios var genoRatio = Object.keys(genoCounts).sort().map(function(k) { return genoCounts[k] + ' ' + k; }).join(' : ');
var domLabel = domTrait || 'Dominant'; var recLabel = recTrait || 'Recessive';
var out = '### Results '; out += 'Cross: ' + g1 + ' × ' + g2 + '
'; out += html; out += ''; out += 'Genotype Probabilities:
'; Object.keys(genoCounts).sort().forEach(function(k) { var pct = (genoCounts[k] / 4 * 100).toFixed(1); out += '- ' + k + ': ' + genoCounts[k] + '/4 = ' + pct + '%'; }); out += ''; out += 'Phenotype Probabilities:
'; out += '' + domLabel + ' (Dominant): ' + domCount + '/4 = ' + (domCount/4*100).toFixed(1) + '%'; out += '' + recLabel + ' (Recessive): ' + recCount + '/4 = ' + (recCount/4*100).toFixed(1) + '%'; out += ''; out += 'Genotypic Ratio: ' + genoRatio + '
'; out += 'Phenotypic Ratio: ' + domCount + ' ' + domLabel + ' : ' + recCount + ' ' + recLabel + '
'; out += ''; return out; }
function punBuildDiSquare(g1, g2, domA, recA, domB, recB) { var gametes1 = punGetDiGametes(g1); var gametes2 = punGetDiGametes(g2); if (!gametes1 || !gametes2) return null;
var results = []; for (var i = 0; i '; html += ''; gametes2.forEach(function(g) { html += '' + g + ''; }); html += ''; for (var i = 0; i ' + gametes1[i] + ''; for (var j = 0; j ' + cell + ''; } html += ''; } html += '';
var dA = domA || 'Dominant A'; var rA = recA || 'Recessive A'; var dB = domB || 'Dominant B'; var rB = recB || 'Recessive B';
var out = '### Results '; out += 'Cross: ' + g1 + ' × ' + g2 + '
'; out += html; out += ''; out += 'Phenotype Probabilities:
'; out += '' + dA + ' + ' + dB + ' (A_B_): ' + phenoCounts['A_B_'] + '/16 = ' + (phenoCounts['A_B_']/16*100).toFixed(1) + '%'; out += '' + dA + ' + ' + rB + ' (A_bb): ' + phenoCounts['A_bb'] + '/16 = ' + (phenoCounts['A_bb']/16*100).toFixed(1) + '%'; out += '' + rA + ' + ' + dB + ' (aaB_): ' + phenoCounts['aaB_'] + '/16 = ' + (phenoCounts['aaB_']/16*100).toFixed(1) + '%'; out += '' + rA + ' + ' + rB + ' (aabb): ' + phenoCounts['aabb'] + '/16 = ' + (phenoCounts['aabb']/16*100).toFixed(1) + '%'; out += ''; out += 'Phenotypic Ratio: ' + phenoCounts['A_B_'] + ' : ' + phenoCounts['A_bb'] + ' : ' + phenoCounts['aaB_'] + ' : ' + phenoCounts['aabb'] + '
'; out += 'Genotype Probabilities (top 5 by frequency):
'; var sortedGenos = Object.keys(genoCounts).sort(function(a,b){ return genoCounts[b]-genoCounts[a]; }).slice(0,5); sortedGenos.forEach(function(k) { out += '- ' + k + ': ' + genoCounts[k] + '/16 = ' + (genoCounts[k]/16*100).toFixed(1) + '%'; }); out += ''; return out; }
function punValidateMono(g) { if (!g || g.length !== 2) return 'Genotype must be exactly 2 characters (e.g., Aa, AA, aa).'; var upper = g[0].toUpperCase(); var lower = g[0].toLowerCase(); if (g[0].toLowerCase() !== g[1].toLowerCase()) return 'Both alleles must use the same letter (e.g., Aa, not Ab).'; if (!/[a-zA-Z]/.test(g[0]) || !/[a-zA-Z]/.test(g[1])) return 'Alleles must be letters only.'; return null; }
function punValidateDi(g) { if (!g || g.length !== 4) return 'Dihybrid genotype must be exactly 4 characters (e.g., AaBb).'; if (!/[a-zA-Z]/.test(g[0]) || !/[a-zA-Z]/.test(g[1]) || !/[a-zA-Z]/.test(g[2]) || !/[a-zA-Z]/.test(g[3])) return 'Alleles must be letters only.'; if (g[0].toLowerCase() !== g[1].toLowerCase()) return 'First gene alleles must use the same letter (e.g., Aa).'; if (g[2].toLowerCase() !== g[3].toLowerCase()) return 'Second gene alleles must use the same letter (e.g., Bb).'; if (g[0].toLowerCase() === g[2].toLowerCase()) return 'Gene A and Gene B must use different letters (e.g., AaBb, not AaAa).'; return null; }
function punCalc() { var resultDiv = document.getElementById('pun-result'); var type = document.getElementById('pun-cross-type').value; var html = '';
if (type === 'mono') { var g1 = document.getElementById('pun-parent1-mono').value.trim(); var g2 = document.getElementById('pun-parent2-mono').value.trim(); var domTrait = document.getElementById('pun-dominant-mono').value.trim(); var recTrait = document.getElementById('pun-recessive-mono').value.trim(); var err1 = punValidateMono(g1); var err2 = punValidateMono(g2); if (err1) { html = 'Parent 1: ' + err1 + ''; } else if (err2) { html = 'Parent 2: ' + err2 + ''; } else { var res = punBuildMonoSquare(g1, g2, domTrait, recTrait); html = res || 'Could not compute. Check inputs.'; } } else { var g1 = document.getElementById('pun-parent1-di').value.trim(); var g2 = document.getElementById('pun-parent2-di').value.trim(); var domA = document.getElementById('pun-dominant-a').value.trim(); var recA = document.getElementById('pun-recessive-a').value.trim(); var domB = document.getElementById('pun-dominant-b').value.trim(); var recB = document.getElementById('pun-recessive-b').value.trim(); var err1 = punValidateDi(g1); var err2 = punValidateDi(g2); if (err1) { html = 'Parent 1: ' + err1 + ''; } else if (err2) { html = 'Parent 2: ' + err2 + ''; } else { var res = punBuildDiSquare(g1, g2, domA, recA, domB, recB); html = res || 'Could not compute. Check inputs.'; } }
resultDiv.innerHTML = html; resultDiv.style.display = 'block'; }
More Calculators
- Lease Break Cost Calculator
- Tax Lien Payoff Calculator
- Tile Cost Estimator
- Tax Withholding Estimator
- Back Taxes Owed Estimator
- IRS Penalty & Interest Calculator
- Tile Layout and Pattern Planner
- Heat Loss Calculator — Wall and Insulation R-Value Estimator
- Furnace Sizing Calculator for Montana Winters
- Montana Climate Zone Heating Load Calculator
- HVAC Load Calculator (Manual J Estimate)
- Heat Load Calculator
Read Next
Tile Layout And Pattern Planner ANA › Life Services Authority › National Calculator Authority › Tile Layout and Pattern Planner .calc-container { max-width:...
Study Time Planner Authority Network America › Life Services Authority › National Calculator Authority .calc-container { max-width: 640px;...