Carpal tunnel syndrome (CTS) occurs more often among individuals with diabetes. The aim of this retrospective observational registry study was to examine whether individuals with diabetes and CTS are treated surgically to the same extent as individuals with CTS but without diabetes. Data on CTS diagnosis and surgery were collected from the Skåne Healthcare Register (SHR). A total of 35,105 individuals (age ≥ 18 years) diagnosed with CTS from 2004-2019 were included. Data were matched to the Swedish National Diabetes Register (NDR. Cox regression models were used to calculate the risk of the use of surgical treatment. Of the 35,105 included individuals with a CTS diagnosis, 17,662 (50%) were treated surgically, and 4,966 (14%) had diabetes. A higher number of individuals with diabetes were treated surgically (2,935/4,966, 59%) than individuals without diabetes (14,727/30,139, 49%). In the Cox regression model, diabetes remained a significant risk factor for surgical treatment (PR 1.14 (95% CI 1.11-1.17)). Individuals with type 1 diabetes were more frequently treated surgically (490/757, 65%) than individuals with type 2 diabetes (2,445/4,209, 58%). There was no difference between the sexes and their treatment. The duration of diabetes was also a risk factor for surgical treatment in diabetes type 2, but high HbA1c levels were not. Individuals with diabetes are more likely to be treated surgically for CTS than individuals without diabetes. Individuals with type 1 diabetes are more likely to be treated surgically for CTS than individuals with type 2 diabetes.