Objectives To determine the timing of viral clearance (first negative RT-PCR on nasopharyngeal swab) and the probability of viral clearance confirmation (two consecutive negative swabs) in COVID-19 patients and to identify related determinants. Design Population-based prospective cohort study on archive data. Setting Preventive services and hospital care in the Reggio Emilia province, northern Italy. Participants All 1162 subjects testing positive to RT-PCR on nasopharyngeal swabs and diagnosed with COVID-19 in the Reggio Emilia province with at least 30 days of follow-up by 22 April 2020. Main outcome measures Median times from diagnosis and from symptom onset to viral clearance with IQR assessed using the Kaplan-Meier estimator, stratified by included characteristics. The probability of viral clearance confirmation, stratified by time from diagnosis and putative determinants assessed using a multivariate logistic regression model. Results Viral clearance was achieved by 60.6% (704/1162) of patients, with a median time of 30 days from diagnosis (IQR 23-40) and 36 days from symptom onset (IQR 28-45). Of those negative and retested, 78.7% (436/554) had viral clearance confirmation, suggesting one in five false negative tests. The time from symptom onset to viral clearance slightly increased with age, from 35 (IQR 26-44) days under age 50 to 38 (IQR 28-44) in over age 80, and with disease severity, from 33 (IQR 25-41) days in non-hospitalised subjects to 38 (IQR 30-47) days in hospitalised patients. The probability of confirmed viral clearance reached 86.8% after 34 days from symptom onset and increased with time, even when adjusting for age and sex (OR 1.16 95% CI 1.06 to 1.26 per day from diagnosis). Conclusions Postponing follow-up testing of clinically recovered COVID-19 patients could increase the efficiency and performance of testing protocols. Understanding viral shedding duration also has implications for containment measures of paucisymptomatic subjects. ► This is one of the few studies providing populationbased evidence on the duration of viral shedding in SARS-CoV-2-positive patients. ► All patients testing positive for SARS-CoV-2 in the province of Reggio Emilia with a minimum follow-up of 30 days up to 22 April 2020 were included. ► The median time from symptom onset and from diagnosis to viral clearance (ie, first negative RT-PCR assay on nasopharyngeal swab) was assessed and stratified by putative determinants. ► The assessment of time to viral clearance was limited by the testing intervals, which in our study reflect the real-world practice. ► The probability of confirmation of viral clearance (ie, two consecutive negative swabs) was also reported overall and stratified by time from diagnosis and symptom onset.