Background: HIV testing rates are suboptimal among at-risk men. Crowdsourcing may be a useful tool for designing innovative, community-based HIV testing strategies to increase HIV testing. The purpose of this study was to use a stepped wedge cluster randomized controlled trial (RCT) to evaluate the effect of a crowdsourced HIV intervention on HIV testing uptake among men who have sex with men (MSM) in eight Chinese cities. Methods and findings: An HIV testing intervention was developed through a national image contest, a regional strategy designathon, and local message contests. The final intervention included a multimedia HIV testing campaign, an online HIV testing service, and local testing promotion campaigns tailored for MSM. This intervention was evaluated using a closed cohort stepped wedge cluster RCT in eight Chinese cities (Guangzhou, Shenzhen, Zhuhai, and Jiangmen in Guangdong province; Jinan, Qingdao, Yantai, and Jining in Shandong province) from August 2016 to August 2017. MSM were recruited through Blued, a social networking mobile application for MSM, from July 29 to August 21 of 2016. The primary outcome was self-reported HIV testing in the past 3 months. Secondary outcomes included HIV self-testing, facility-based HIV testing, condom use, and syphilis testing. Generalized linear mixed models (GLMMs) were used to analyze primary and secondary outcomes. We enrolled a total of 1,381 MSM. Most were ≤30 years old (82%), unmarried (86%), and had a college degree or higher (65%). The proportion of individuals receiving an HIV test during the intervention periods within a city was 8.9% (95% confidence interval [CI] 2.2–15.5) greater than during the control periods. In addition, the intention-to-treat analysis showed a higher probability of receiving an HIV test during the intervention periods as compared to the control periods (estimated risk ratio [RR] = 1.43, 95% CI 1.19–1.73). The intervention also increased HIV self-testing (RR = 1.89, 95% CI 1.50–2.38). There was no effect on facility-based HIV testing (RR = 1.00, 95% CI 0.79–1.26), condom use (RR = 1.00, 95% CI 0.86–1.17), or syphilis testing (RR = 0.92, 95% CI 0.70–1.21). A total of 48.6% (593/1,219) of participants reported that they received HIV self-testing. Among men who received two HIV tests, 32 individuals seroconverted during the 1-year study period. Study limitations include the use of self-reported HIV testing data among a subset of men and non-completion of the final survey by 23% of participants. Our study population was a young online group in urban China and the relevance of our findings to other populations will require further investigation. Conclusions: In this setting, crowdsourcing was effective for developing and strengthening community-based HIV testing services for MSM. Crowdsourced interventions may be an important tool for the scale-up of HIV testing services among MSM in low- and middle-income countries (LMIC). Trial registration: ClinicalTrials.gov NCT02796963.