Melanoma is a common cancer in the Western world with an increasing incidence. Sun exposure is still considered to be the major risk factor for melanoma. The prognosis of patients with malignant (advanced-stage) melanoma differs widely between countries, but public campaigns advocating early detection have led to significant reductions in mortality rates. As well as sun exposure, distinct genetic alterations have been identified as associated with melanoma. For example, families with melanoma who have germline mutations in CDKN2A are well known, whereas the vast majority of sporadic melanomas have mutations in the mitogen-activated protein kinase cascade, which is the pathway with the highest oncogenic and therapeutic relevance for this disease. BRAF and NRAS mutations are typically found in cutaneous melanomas, whereas KIT mutations are predominantly observed in mucosal and acral melanomas. GNAQ and GNA11 mutations prevail in uveal melanomas. Additionally, the PI3K-AKT-PTEN pathway and the immune checkpoint pathways are important. The finding that programmed cell death protein 1 ligand 1 (PDL1) and PDL2 are expressed by melanoma cells, T cells, B cells and natural killer cells led to the recent development of programmed cell death protein 1 (PD1)-specific antibodies (for example, nivolumab and pembrolizumab). Alongside other new drugs - namely, BRAF inhibitors (vemurafenib and dabrafenib) and MEK inhibitors (trametinib and cobimetinib) - these agents are very promising and have been shown to significantly improve prognosis for patients with advanced-stage metastatic disease. Early signs are apparent that these new treatment modalities are also improving long-term clinical benefit and the quality of life of patients. This Primer summarizes the current understanding of melanoma, from mechanistic insights to clinical progress. For an illustrated summary of this Primer, visit: http://go.nature.com/vX2N9s.