BACKGROUND: An alternative approach to investigate associations between genetic variants and disease is to examine deviations from the Hardy-Weinberg equilibrium (HWE) in genotype frequencies within a case population, instead of case-control association analysis. The HWE analysis requires disease cases and demonstrates a notable ability in mapping recessive variants. Allelic heterogeneity is a common phenomenon in diseases. While gene-based case-control association analysis successfully incorporates this heterogeneity, there are no such approaches for HWE analysis. Therefore, we proposed a gene-based HWE test (gene-HWT) by aggregating single-nucleotide polymorphism (SNP)-level HWE test statistics in a gene to address allelic heterogeneity. RESULTS: This method used only genotype count data and publicly available linkage disequilibrium information and has a very low computational cost. Extensive simulations demonstrated that gene-HWT effectively controls the type I error at a low significance level and outperforms SNP-level HWE test in power when there are multiple causal variants within a gene. Using gene-HWT, we analyzed genotype count data from a genome-wide association study of six cancer types in Japanese individuals and suggest DGKE and ANO3 as potential germline factors in colorectal cancer. Furthermore, FSTL4 was suggested through a combined analysis across the six cancer types, with particularly notable associations observed in colorectal and prostate cancers. CONCLUSIONS: These findings indicate the potential of gene-HWT to elucidate the genetic basis of complex diseases, including cancer.