BackgroundSocial media causes increased use and problems due to their attractions. Hence, it can affect mental health, especially in students. The present study was conducted with the aim of determining the relationship between the use of social media and the mental health of students.Materials and methodsThe current cross-sectional study was conducted in 2021 on 781 university students in Lorestan province, who were selected by the Convenience Sampling method. The data was collected using a questionnaire on demographic characteristics, social media, problematic use of social media, and mental health (DASS-21). Data were analyzed in SPSS-26 software.ResultsShows that marital status, major, and household income are significantly associated with lower DASS21 scores (a lower DASS21 score means better mental health status). Also, problematic use of social media (β = 3.54, 95% CI: (3.23, 3.85)) was significantly associated with higher mental health scores (a higher DASS21 score means worse mental health status). Income and social media use (β = 1.02, 95% CI: 0.78, 1.25) were significantly associated with higher DASS21 scores (a higher DASS21 score means worse mental health status). Major was significantly associated with lower DASS21 scores (a lower DASS21 score means better mental health status).ConclusionThis study indicated that social media had a direct relationship with mental health. Despite the large amount of evidence suggesting that social media harms mental health, more research is still necessary to determine the cause and how social media can be used without harmful effects.