When proteins are broken down, either by bacterial decomposition or as a waste product of protein metabolism, ammonia is formed. Bacterial action converts ammonia, which is extremely toxic, into less toxic nitrite, which in turn is converted to nitrate, a relatively harmless substance. This process of converting ammonia into nitrate is called nitrification. The main source of ammonia in koi ponds is fish metabolism. Metabolism is a general term covering all the various processes taking place in living organisms, such as food digestion, energy production, tissue repair and cell growth.
Any surplus is stored as body fat or excreted as waste.
Excess amino acids cannot be stored and end up being converted to ammonia in a process called deamination and then excreted into the water via the gills. Any undigested food is passed out with the faeces. This process is not exclusive to fish, indeed all animals produce metabolic ammonia. However, in most animals ammonia is immediately converted into a less toxic substance, usually urea, and excreted in the urine. Koi, being voracious eaters, produce large amounts of ammonia and may be considered as ammonia factories, converting expensive fish food into ammonia and other wastes.