Adsorptive removal by porous carbon materials has been considered an attractive technique to treat wastewater polluted by antibiotics. To produce porous biochar with high-yield and high-performance for chloramphenicol adsorption, this study prepared biochar from peanut shells using ammonium polyphosphate via pyrolysis . The combined effects of the main process parameters on biochar production were studied to determine the optimum operating conditions by response surface methodology based on Box-Behnken design. Low-dose ammonium polyphosphate has a significant positive effect on the yield, surface functional groups, pore volume , and surface area of biochar. This is caused by the richness of nitrogen and phosphorus in ammonium polyphosphate and its flame retardant property. The high-yield biochar with a surface area of 979 ± 25 m 2 /g was obtained at a mass ratio of ammonium polyphosphate/peanut shell of 0.55, at 650 °C with a retention time of 60 min. The as-prepared biochar exhibited excellent adsorption performance with a monolayer chloramphenicol adsorption capacity of 423.7 mg/g. This was due to the high surface area, micropores formed by nano-sized particles, and richness of N- and P-containing functional groups. The characterization before and after chloramphenicol adsorption indicated micro-pore-filling, Van der Waals force, π-π interaction, and hydrogen-bonding interaction are the main adsorption mechanisms of chloramphenicol adsorption on as-prepared biochar. This study offered new insights on the preparation of biochar from waste biomass for application in wastewater treatment .