Antibiotics along with their metabolites due to their toxicity and low biodegradability have adverse effects to human and animal health. This work can help to monitor and elimination of the residue of the cloxacillin (Clox) antibiotics in two ways: the first part involves design and fabrication of a new electrochemical nanosensor based on a screen-printed carbon electrode modified with gold nanourchin and graphene oxide for detection and determination of Clox in aqueous media. The second part focuses on the preparation of carbon nanocomposites modified with multi-walled carbon nanotubes (MWCNT/CC) as adsorbent for the removal of Clox from aqueous medium. The MWCNT/CC nanocomposites were made using sol-gel process and then the efficiency of the antibiotic removal was assessed by the designed nanosensor. In Clox removal experiments, the effect of independent variables including pH, exposure time, extent of MWCNTs and amount of adsorbent on the removal of antibiotic as a dependent variable was investigated using response surface methodology. The morphological and physical properties of the suggested adsorbent were explored. The maximum efficiency of Clox removal (97%) was achieved in conditions of using 1.52 g/L of the adsorbent fabricated by 2.9 wt. % of MWCNTs in 0.1 M phosphate buffer solution at pH of 5.0 during 75 minutes. The highest adsorption capacity of the MWCNT/CC was 296 mg/g at optimal conditions.