This study explored the impact of legal cognition on risky online behavior and deviant behavior of adolescents in Taiwan. The independent variables of the analysis model were adolescents' legal cognition, including the dimensions of "The Protection of Children and Youths Welfare and Rights Act" and other legal concepts. The dependent variables were risky online behavior and deviant behavior. The mediation variables included the time adolescents spent chatting with their parents per day, online time per day, exercising time in the past week, and volunteer services time in the past year. The raw data of this research was based on 2,020 participants from the Survey of Children and Adolescents' Living Conditions and Welfare Needs conducted by the New Taipei City government in 2017. Structural equation modeling was applied for statistical analysis. The results show that risky online behavior was affected by adolescents' legal cognition in both dimensions and the time they spent chatting with their parents per day, online time per day, and volunteer services time in the past year. Deviant behavior was affected by cognition in other legal concepts, online time per day, and exercising time in the past week. A significant mediation effect was shown on the time adolescents spent chatting with their parents per day in the analysis of the multiple mediation model. Researchers have made conclusions and given suggestions according to the above results.