Hepatocellular carcinoma (HCC) is sexually dimorphic in both rodents and humans, with significantly higher incidence in males, an effect that is dependent on sex hormones. The molecular mechanisms by which estrogens prevent and androgens promote liver cancer remain unclear. Here, we discover that sexually dimorphic HCC is completely reversed in Foxa1- and Foxa2-deficient mice after diethylnitrosamine-induced hepatocarcinogenesis. Coregulation of target genes by Foxa1/a2 and either the estrogen receptor (ERα) or the androgen receptor (AR) was increased during hepatocarcinogenesis in normal female or male mice, respectively, but was lost in Foxa1/2-deficient mice. Thus, both estrogen-dependent resistance to and androgen-mediated facilitation of HCC depend on Foxa1/2. Strikingly, single nucleotide polymorphisms at FOXA2 binding sites reduce binding of both FOXA2 and ERα to their targets in human liver and correlate with HCC development in women. Thus, Foxa factors and their targets are central for the sexual dimorphism of HCC.