Abstract Background Multiple sclerosis (MS) is a debilitating neurological disease characterized by inflammation, demyelination, and neurodegeneration in the central nervous system. Despite extensive research, the pathology of MS remains incompletely understood. Ocrelizumab (OCRE), a monoclonal antibody targeting CD20-positive B cells, has shown efficacy in relapsing (RR) and primary progressive (PP) MS. Neurofilaments (Nf) are emerging biomarkers of neuroaxonal injury, reflecting disease activity and treatment response in MS. This study aimed to assess the impact of OCRE on serum Nf levels (NfLs) in RRMS and PPMS patients and explore factors influencing treatment response. Methods A prospective study included 23 RRMS and PPMS patients initiating OCRE and 23 healthy controls. Serum NfLs were quantified using ELISA. Statistical analyses evaluated changes in NfLs and factors influencing treatment response. Results MS patients exhibited significantly higher NfLs than controls. OCRE treatment led to a significant reduction in NfLs after one cycle. Age and gender influenced treatment response, with older patients and females experiencing greater NfL reduction. Disability level and disease duration did not significantly affect NfLs reduction. Both RRMS and PPMS patients showed decreased NfLs levels with OCRE treatment. Conclusions In conclusion, OCRE demonstrated efficacy in reducing NfLs levels in RRMS and PPMS patients after one cycle, with potential age and gender-related variations in treatment response. Larger longitudinal studies are needed to further elucidate OCRE’s mechanisms and implications for personalized MS treatment.