In the present study, magnesium oxide/granular activated carbon (MgO/GAC) composite as a catalyst was synthesized using the sol-gel method and its catalytic potential was investigated in the presence of ultraviolet (UV) irradiation for the removal of cephalexin (CLX) in a batch mode reactor. Then, the characterization of the MgO/GAC composite was determined by X-ray diffraction (XRD) and scanning electron microscopy (SEM). Next, the effect of operational parameters was evaluated, including the pH of the solution (3-11), the dosage of composite (1-6 g/L), initial CLX concentration (20-100 mg/L), and contact time (10-60 minutes). The maximum CLX degradation with an initial concentration of 20 mg/L was as high as 98% at pH=3, 4 g/L of MgO/GAC composite with UV irradiation within 60-minute contact time. In addition, the removal process of CLX could be described by the pseudofirst-order kinetic. Further, the chemical oxygen demand (COD) and total organic carbon (TOC) removal rate were 78% and, 62.3% in optimum conditions, respectively. The results indicated that the UV/MgO/GAC hybrid photocatalytic process can be considered as an efficient alternative for treating the wastewater containing CLX.