Neurocutaneous syndromes are associated with cancer predisposition and sometimes associated with perinatal factors. A better understanding of the association between neurocutaneous syndromes, perinatal factors, and childhood cancer is key for earlier cancer detection. To evaluate the association of neurocutaneous syndromes and perinatal factors with childhood cancer risk in a cohort of Swedish children. In this nationwide cohort study, all children and adolescents up to age 20 years, from 1973 to 2015, were identified through the Swedish National Medical Birth Register (MBR), provided they had information on both biological parents. Analyses were conducted from April 2021 through May 2023. Diagnoses of neurocutaneous syndromes were obtained from the MBR, National Patient Register, and Cause of Death register. Perinatal factors (birth weight, gestational age, birth weight by gestational age, 5-minute Apgar score, and head circumference) were obtained from the MBR. Childhood cancer risk (<20 years at diagnosis; identified from the National Cancer Register), including leukemia, lymphoma, and central nervous system (CNS) tumors. Among 4 173 108 included children (2 143 133 [51.4%] male, median [IQR] follow-up 20 [9.7-20] years), 1783 had neurofibromatosis type 1 (NF1), 444 tuberous sclerosis, 63 von Hippel-Lindau disease, and 39 ataxia-telangiectasia. An increased cancer risk was observed among children with any neurocutaneous syndrome (HR, 34.9; 95% CI, 30.8-39.6) and was particularly pronounced for CNS tumors (HR, 111.7; 95% CI, 96.8-128.8), except among children with ataxia-telangiectasia, where the increased risk was associated with lymphomas (HR, 233.1; 95% CI, 75.0-724.1). Leukemia risk was increased only among children with NF1 (HR, 4.1; 95% CI, 1.7-9.8). Several perinatal factors, including high birth weight, being born large for gestational age, preterm birth, low 5-minute Apgar score, and large head circumference had lesser associations with childhood cancer. Adjusting for neurocutaneous syndromes did not affect these associations. In this nationwide cohort study, neurocutaneous syndromes were associated with an increased risk of childhood cancer, especially CNS tumors. Several perinatal factors had lesser associations with childhood cancer, independently of the presence of neurocutaneous syndromes. Other biological mechanisms likely underlie the association between perinatal factors and childhood cancer.