The magnesium depletion score (MDS) is a scoring system developed to predict magnesium deficiency based on pathophysiological factors that affect renal reabsorption. The relationship between systemic magnesium status and arthritis is unclear. The purpose of this study was to determine the association between the MDS and rheumatoid arthritis (RA) as well as osteoarthritis (OA). This study was conducted through a cross-sectional survey of 20,513 adults aged ≥ 20years who participated in NHANES from 2007 to 2018. The four dimensions of the MDS included diuretics, proton pump inhibitors, glomerular filtration rate, and excessive alcohol consumption. Univariate and multivariable-weighted logistic regression were used to assess the associations between MDS and RA/OA, and a test for trend was performed to analyze the presence of a dose-response relationship. Subgroup analyses and interaction tests were performed according to confounders. After adjustment for all covariates, we found a graded dose-response relationship between MDS and RA or OA. When MDS was considered as a continuous variable, each onefold increase in MDS was associated with a 1.21-fold increase in the odds of having RA (OR = 1.21, 1.10, 1.33) and a 1.12-fold increase in the odds of having OA (OR = 1.12, 1.04, 1.21). There was an interaction of sex in the effect of MDS on RA (Pinteraction = 0.004) and age in the effect of MDS on OA (Pinteraction = 0.006). In addition, these associations were further confirmed in sensitivity and subgroup analyses. Our study identified significant dose-response associations between MDS and both RA and OA. More biological mechanisms are needed in the future to validate and clarify the results of this study.