Ammonia and its amine-containing derivatives are widely found in natural decomposition byproducts. Here, we conducted biased chemoreceptor screening to investigate the mechanisms by which different concentrations of ammonium salt, urea, and putrescine in rotten fruits affect feeding and oviposition behavior. We identified three ionotropic receptors, including the two broadly required IR25a and IR76b receptors, as well as the narrowly tuned IR51b receptor. These three IRs were fundamental in eliciting avoidance against nitrogenous waste products, which is mediated by bitter-sensing gustatory receptor neurons (GRNs). The aversion of nitrogenous wastes was evaluated by the cellular requirement by expressing Kir2.1 and behavioral recoveries of the mutants in bitter-sensing GRNs. Furthermore, by conducting electrophysiology assays, we confirmed that ammonia compounds are aversive in taste as they directly activated bitter-sensing GRNs. Therefore, our findings provide insights into the ecological roles of IRs as a means to detect and avoid toxic nitrogenous waste products in nature.