Introduction: There is little published literature about gay, bisexual and other men who have sex with men and transgender individuals (MSM and TG)'s use of social media in sub-Saharan Africa, despite repressive social and/or criminalizing contexts that limit access to physical HIV prevention. We sought to describe MSM and TG's online socializing in Nairobi and Johannesburg, identifying the characteristics of those socializing online and those not, in order to inform the development of research and health promotion in online environments. Methods: Respondent-driven sampling surveys were conducted in 2017 in Nairobi (n = 618) and Johannesburg (n = 301) with those reporting current male gender identity or male sex assigned at birth and sex with a man in the last 12 months. Online socializing patterns, sociodemographic, sexual behaviour and HIV-testing data were collected. We examined associations between social media use and sociodemographic characteristics and sexual behaviours among all, and only those HIVuninfected, using logistic regression. Analyses were RDS-II weighted. Thirty qualitative interviews were conducted with MSM and TG in each city, which examined the broader context of and motivations for social media use. Results: Most MSM and TG had used social media to socialize with MSM in the last month (60% Johannesburg, 71% Nairobi), mostly using generic platforms (e.g. Facebook), but also gay-specific (e.g. Grindr). HIV-uninfected MSM and TG reporting riskier recent sexual behaviours had raised odds of social media use in Nairobi, including receptive anal intercourse (adjusted OR = 2.15, p = 0.006), buying (aOR = 2.24, p = 0.015) and selling sex with men (aOR = 2.17, p = 0.004). Evidence for these associations was weaker in Johannesburg, though socializing online was associated with condomless anal intercourse (aOR = 3.67, p = 0.003) and active syphilis (aOR = 13.50, p = 0.016). Qualitative findings indicated that while online socializing can limit risk of harm inherent in face-to-face interactions, novel challenges were introduced, including context collapse and a fear of blackmail. Conclusions: Most MSM and TG in these cities socialize online regularly. Users reported HIV acquisition risk behaviours, yet this space is not fully utilized for sexual health promotion and research engagement. Effective, safe and acceptable means of using online channels to engage with MSM/TG that account for MSM and TG's strategies and concerns for managing online security should now be explored, as complements or alternatives to existing outreach.