Intellectual disability (ID) is a disorder with unknown aetiology in many cases. Maternal alcohol use is a known risk factor for ID, but less is known about the importance of maternal and paternal substance use disorder (SUD) and risk of ID in offspring. Data from multiple nationwide registers were used to create a cohort of children born from January 01, 1978 to December 31, 2002. All participants were born in Sweden, had available parental identification information and did not emigrate or die before age 12 (n=1,940,820). Logistic regression modelling was performed with exposure defined as having a parent who received any SUD diagnosis, including alcohol use disorder (AUD) and drug use disorder (DUD). The outcome was registration of diagnosis of any form of ID. First, we analysed the risk of ID if parental SUD was registered prior to childbirth with stepwise adjustment of multiple covariates. Second, the effect of timing of SUD diagnosis in relation to childbirth was analysed. Of 37,410 offspring with parental SUD registered prior to birth, 3.0% (n=1110) had any form of ID compared to 1.2% (n=23,168) of those 1,903,410 individuals without parental SUD prior birth. Parental SUD prior birth was associated with an increased risk of any form of ID (Odds Ratio [OR]: 2.3 [2.2-2.5]), with ORs similar for maternal (OR: 2.3 [2.1-2.5]) and paternal SUD (OR: 2.3 [2.1-2.5]). These ORs were reduced but remained statistically significant after adjusting for parental education, migration, psychiatric comorbidity, and co-parent SUD (OR parental SUD: 1.6 [1.5-1.8]; OR maternal SUD: 1.4 [1.2-1.5]; OR paternal SUD: 1.6 [1.5-1.7]). Parental SUD was associated with increased risk of ID in offspring irrespective of timing of diagnosis, but if mothers or fathers were diagnosed with AUD during pregnancy (OR maternal AUD: 5.0 [3.1-8.2]; OR paternal AUD: 2.8 [2.2-3.6]), the risk was significantly greater than if the AUD diagnosis was first registered after childbirth (OR maternal AUD: 1.9 [1.8-2.0]; OR paternal AUD: 1.6 [1.6-1.7]). Both paternal and maternal SUD were associated with an increased risk of ID in offspring, with greatest risk observed when AUD was diagnosed during pregnancy. Possible mechanisms may involve shared genetic and environmental factors, including toxic effects from alcohol intake. These findings have clinical implications in suggesting that parental SUD in either parent represents a possibly modifiable risk factor to consider when developing prevention, diagnostics and treatment programs for children with ID. Stockholm County Council, the Research Council of the Swedish Alcohol Retailing Monopoly, Fredrik and Ingrid Thurings stiftelse, Academy of Finland, the Swedish Research Council and the Swedish Research Council for Health, Working Life and Welfare, Nordforsk by the Nordic Council of Ministers and the Polish Medical Research Agency.