This is as important as water chemistry. Most of the complexities of chemistry can be avoided by keeping fish in local water, and providing good water quality is a continuing process. This process has two parts.

First you must ensure that no harmful chemicals are in the aquarium.
Second, you must deal with waste products produced by the fish.

Many fish come from unpolluted water and are very sensitive to any contaminants even their own. Some are more tolerant, but it is still unwise to provide less than perfect water quality in captivity. Having the largest possible volume of natural waters acts as a safety net as it is effected more slowly by fish poo by volume

All the equipment and decorations must be non toxic. When you can you should use items intended specifically for aquariums. Any non aquatic plastics should be of food quality. Avoid colored types, as well as those with a nasty taste. Metals could corrode and should not be used unless designed for aquarium use.

Rocks should not affect the water, but you should be aware of colored crystals that might be poisonous to your fish. Garden items could contain fertilizers or pesticides and should not be sued. Wood could leach tannins or preservatives, and should be coated with a varnish made of polyurethane. A complete list of toxins is impossible so you should always be careful.

And, if you were not wary enough already, the water from your tap could have invisible surprises that are not good for your fish. Water that has been in metal pipes could have metallic oxide. Usually this type of contamination so slight but it can accumulate in the aquarium so you should run the tap for a bit before collecting water. You should never utilize water from a copper water cylinder.

Water companies should provide potable water, but this does not always mean it is aquarium quality. Chemical treatments and pollution levels that are harmless to us can be fatal to fish. The most common additive is chlorine, which is highly toxic to fish. However, if water is left to stand for up to twenty four hours the gas will evaporate. This can be speeded up by aeration.

There is now an alternative purification agent being used by some water companies called chloramine, and it does not disperse naturally. However, you can purchase water conditioners to neutralize this chemical. Ask your utility institution if they utilize this chemical or have plans to in the future, and ask to be told whenever they are about to eliminate aquatic invertebrates in the water mains, because the DDT used is lethal to fish. Be nice and polite, as their only obligation is to provide drinkable water. If you are not nice they may not help with your fish. The main disadvantage to all this is that when the system becomes clogged, cleaning involves a major upheaval.

One thing that can minimize this problem is a reverse flow UG system that utilizes an external filter canister. The outlet is connected to the UG uplift so that water is propelled through the substrate. This however also does away with the advantage of UG which is that the system inlet is now the same as the pre filter, which is undoubtedly also the primary area of bacterial activity. Reverse flow structures create no surface turbulence and this could end in reduction of oxygen unless the tank is aerated.

Tap water could have phosphates and nitrates. This is especially true when water levels are small and pollutant absorptions are high. Fortunately, for the aquarist whose tap water originates from an upland tank or other uncontaminated source, a nitrate test kit is available from select retailers. Nitrates should be removed form the water that is planned for the aquarium via reverse osmosis or a special filter connected to the tap.