Mindfulness and self-compassion have the potential to alleviate loneliness, a significant public health concern. To maximize the impact of mindfulness and self-compassion on loneliness, it is essential to understand the mechanisms underlying their effects. The current cross-sectional study aimed to explore the mediating role of coping style in the relationships between mindfulness, self-compassion, and loneliness. Participants (n = 453) were recruited from the general population through social network platforms in China. Participants completed an online survey including measures of demographic information, dispositional mindfulness, self-compassion, coping style, and loneliness. Correlation analyses revealed that mindfulness and self-compassion both had significantly negative associations with loneliness; negative coping was positively correlated with loneliness, while positive coping was not significantly associated with loneliness; mindfulness and self-compassion were positively related to positive coping and negatively associated with negative coping. Furthermore, mediation analyses showed that negative coping significantly mediated the effects of mindfulness and self-compassion on loneliness while controlling for demographic variables. These findings suggest that negative coping may serve as a potential mechanism linking mindfulness and self-compassion to loneliness. If future longitudinal and experimental research confirms the mediating effect of negative coping, mindfulness and self-compassion interventions can address negative coping to optimize their effects on loneliness.