Although Danggui-Shaoyao-San (DSS) is frequently used in China to treat melasma, its underlying mechanism still needs to be better understood. Our aim is to determine the mechanism behind DSS in treating melasma through network pharmacology (NP). The DSS active compounds alongside corresponding target genes are identified by accessing the TCMSP database and SwissTargetPrediction. Melasma-associated targets are retrieved from the GeneCards, DisGeNet, Durgbanks, OMIM, and TTD databases. Next, we build a component-target association network via Cytoscape software while generating a protein-protein interaction network utilizing the STRING database. Subsequently, both core target genes and active compounds are determined. Through the DAVID database and Bioinformatics tools, Gene Ontology (GO) and Kyoto Encyclopedia of Genes and Genomes (KEGG) enrichment analyses are conducted. Lastly, the CB-Dock2 server is deployed to conduct molecular docking (MOD). The results manifest that alisol B, cerevisterol, and Wallichilide, among others, are active compounds in DSS, while PTGS2, ESR1, and ESR2 are core target genes. Both GO and KEGG analyses showcase that the potential core drug components modulate pathways in cancer, chemical carcinogenesis-receptor activation, calcium, relaxin, and estrogen signaling by exerting their effects on biological processes. These processes include negative gene expression regulation as well as positive regulation of both cytosolic calcium ion concentration and transcription from the RNA polymerase II promoter, thereby playing an anti-melasma pharmacological role. The MOD displays that core target genes have good binding activity with the active compounds. To conclude, NP demonstrates that DSS can serve as an innovative medication for treating melasma.