The noise is called "water hammer," and you hear it you’re your toilet float valve or faucets shut off suddenly. This happens most often in homes whose plumbing pipes are copper.
To stop the noise, install a new float valve in your toilet tank that is marked as a “quiet-fill” product. Look for a float valve without the float on an arm. You can buy one at any hardware store. It will come with good installation instructions. Replacing you float valve is a fairly easy do-it-yourself project.
Another cause for water hammer is high water pressure. In this case, have a plumber install a pressure-reducing valve. This will throttle down the pressure to no more than 60 or so pounds per square inch. The valve is installed at the inlet where the water service enters the house. This involves soldering, so you might want to call a plumber.
If you try those solutions and still hear the clanging, install an air pressure regulator, also called a water hammer arrester, at the location of the noise. This small device is an air-filled container with a spring in it that acts like a water-pressure shock absorber when you turn a faucet on or off or when you flush the toilet.
Want to do it yourself? Open the vanity cabinet doors and look on the wall for two shut-off valves for the hot and cold water. Turn the water off. Connecting those two valves to the fixture is a supply flex, a braided stainless steel or rubber hose. Remove the supply flex from the shut-off valves. Mount the arrestor to the valve. A part of the arrestor is an outport. Reattach the supply flex to the valves through that outport.
###