DNA repair is related to many physiological and pathological processes, including pigmentation. Little is known about the role of the transcriptional cofactor Mediator complex in DNA repair and pigmentation. Here, we demonstrate that Mediator MED23 plays an important role in coupling UV-induced DNA repair to pigmentation. The loss of Med23 specifically impairs the pigmentation process in melanocyte-lineage cells and in zebrafish. Med23 deficiency leads to enhanced nucleotide excision repair (NER) and less DNA damage following UV radiation because of the enhanced expression and recruitment of NER factors to chromatin for genomic stability. Integrative analyses of melanoma cells reveal that MED23 controls the expression of a melanocyte master regulator, Mitf, by modulating its distal enhancer activity, leading to opposing effects on pigmentation and DNA repair. Collectively, the Mediator MED23/MITF axis connects DNA repair to pigmentation, thus providing molecular insights into the DNA damage response and skin-related diseases.