The ballcock assembly refills your toilet after it flushes. The ballcock consists of the fill valve and the float assembly. After the water empties out of the tank, the float assembly lowers, which causes the fill valve to open. As the water level rises, it carries the float valve up with it, eventually shutting off the fill valve. If you have a broken ballcock assembly, the best way to repair it is by replacing the whole assembly.
Turn off the water supply for the toilet tank where you wish to repair the ballcock assembly. The water supply valve for toilets is usually mounted on the wall or floor behind the toilet. There will be a hose or tube leading from the supply valve to the tank. Rotate the knob on the end of the valve clockwise to cut off the water.
Remove the lid from the toilet tank and set aside. Flush the tank. Hold the handle down to keep the flapper in the open position. This allows the water inside to empty into the tank.
Unclip the overflow hose from the top of the overflow tube in the tank.
Wipe up any water inside the tank with the towel. Place another dry towel on the floor underneath the tank. Unscrew the coupling at the bottom of the tank with a pair of pliers. Wipe up any water that spills out with the towel.
Unscrew the nut that surrounds the ballcock threads on the underside of the toilet tank with a wrench. Pull the old ballcock assembly out of the toilet.
Turn the new ballcock assembly upside down. Apply a thin coat of silicone grease to the stopper on the underside of the ballcock. Insert the ballcock into the tank so that the ends poke out through the underside of the tank. Thread the nut onto the bottom of the ballcock with your free hand.
Connect the overflow hose to the top of the overflow tube. Wrap the bottom threads of the ballcock with plumber's tape. Reconnect the coupling and tighten with the wrench.
It's necessary to replace the ballcock assembly by repairing it because many older ballcock assemblies do not have anti-siphon technology built into the fill valves, which is required in many municipalities.