Our research explores how leisure-time sedentary behavior (SB) correlates with stroke risk. Additionally, we utilize the isotemporal substitution model (ISM) to examine how replacing brief durations of leisure-time SB with light physical activity (LPA), moderate physical activity (MPA), vigorous physical activity (VPA), and sleep might influence the risk of stroke. This investigation tracked 478,198 participants from the UK Biobank. Data regarding individual leisure-time SB and PA were collected through a standardized questionnaire. A Cox proportional hazards model, alongside an isotemporal substitution model (ISM), was utilized. We identified 10,003 cases of incident stroke over 12.7 years. When compared to participants who engaged in leisure-time SB for less than 4hours per day, the hazard ratios (HRs) for stroke incidence increased with more prolonged leisure-time SB: HRs were 1.06 (95% CI: 1.01 to 1.11) for 4-6h/d, 1.16 (95% CI: 1.10 to 1.23) for 6-8h/d, and 1.24 (95% CI: 1.15 to 1.33) for over 8h/d. According to the ISM analysis, substituting leisure-time SB with various forms of PA could markedly reduce stroke risk. For individuals sleeping ≤8h/d, replacing one hour of leisure-time SB with an equivalent duration of LPA, VPA, or sleep corresponded to a 3.0%, 7.0%, and 22.0% decrease in stroke risk, respectively. Meanwhile, for those already sleeping more than 8h/d, substituting one hour of leisure-time SB with an equivalent duration of LPA or VPA resulted in a notable decrease in the risk of stroke by 6.0% and 18.0%, respectively. The findings demonstrate that leisure-time SB and unhealthy sleep durations are confirmed risk factors for stroke. For individuals sleeping 8hours or less per day, and for those who sleep more than 8hours, substituting SB with an adequate amount of sleep or engaging in VPA, respectively, emerges as an effective strategy for reducing stroke risk.